`
love~ruby+rails
  • 浏览: 849546 次
  • 性别: Icon_minigender_1
  • 来自: lanzhou
社区版块
存档分类
最新评论

Make Linux faster and lighter<1>

阅读更多

With just a few tweaks, your Linux box can be lighter, sprightlier and quicker than ever before. Read on for the best ways to speed up your boot sequence, optimise KDE and Gnome, and get betterperformance from your favourite apps. We've also got some top tips from our favourite free software gurus...

Gone are the days when you could make a cup of tea and drink it in the time it takes your computer's operating system to boot (with one notable exception). On that basis, you might think that your Linux machines are already performing at the fastest possible speed, right?

Sadly, this is not always the case. Communities developing mainstream Linux distributions have to appeal to the widest possible audience and ensure compatibility with the widest range of hardware. This means that someone running a mainstream distro on a netbook or a low-end PC may well be using many of the same settings as someone with a high-end gaming machine. But it doesn't have to be this way!

With just a few tweaks and some experimentation, your Linux system can realise your machine's untapped potential. Do you have a dual-core processor? Take advantage of this by running boot processes in parallel. Do you have more memory than you know what to do with? You could try caching data in memory rather than swapping space for faster access.

The great strength of everyone's favourite free OS is that it can be customised from the ground up, so Linux is the ideal tool to tailor to your needs. But once you have an ultrafast system, how can you become more productive? We've consulted prominent members of the free software community for their favourite tips that make their systems more productive - and they could do the same for you.

 

Make Linux boot faster

Any productive machine needs to be up and running as soon as possible, and a sluggish boot can hinder your efforts – which is why boot times were the first thing we thought about improving. One word of warning before you begin: we recommend that you make a backup before you make these alterations, as a bug in your bootloader can render your Linux box unbootable!

Remove the timeout

You may notice that each time you boot there's a small count-down from three to zero, which is great if you regularly select a different OS or Linux kernel at boot time, but useless if you always boot into the same distro. Fortunately, it's easy to remove by opening /boot/grub/menu.lst in a text editor with root permissions and finding the line showing:

timeout=3

Once you've found it, change the value to zero. Save and exit then reboot and you should notice you have just knocked three seconds off your boot time.

Improve disk performance

If you have a DMA-compatible (Direct Memory Access) hard drive, you can increase data throughput threefold with a simple tweak. This will improve boot times because read times will be reduced, and overall performance will increase whenever the hard disk is accessed.

Start by installing hdparm through your package manager, then fire up a root terminal and type: hdparm -d1 /dev/hda1 replacing /dev/hda1 with the location of your boot partition to increase startup times or the root partition to increase general performance. Gnome users can have this run automatically each startup by heading to System > Administration > Services . You can then add this line as an entry with gksudo at the start to ensure it runs with root permissions without requiring additional authentication.

Run boot processes in parallel

Parallelism can lead to big performance boosts, because running two processes at once will take half the time of running them sequentially (at least in theory). You can take advantage of this technique in Grub by firing up /etc/init.d/rc in a text editor with root permissions and finding the following line:

CONCURRENCY=none

You would then replace none with shell before saving and closing your text editor. When you reboot you should see a noticeable decrease in your boot times (around one or two seconds in most cases). If you don't see an increase, this is because this tweak is aimed primarily at systems with multi-core processors. If you have a solo-core processor you could actually increase your boot time if you use this tweak, which was the case with our test system where we saw a 2.4-second increase.

You could edit a text file and restart your machine to profile your system, or just click a few buttons in Grub.

You could edit a text file and restart your machine to profile your system, or just click a few buttons in Grub.

Optimise memory

One great way to improve performance is to define how swap space is used. A swap partition is where the Linux kernel caches data in virtual memory to quickly swap into RAM as and when it's needed. A dedicated partition isn't compulsory, but the space is also used to store your machine state if you choose to hibernate. The effects of this tip depend on your system and whether you have a swap partition, but if you have plenty of RAM you'll find that reducing swappiness will give you a noticeable performance boost.

This will allow the kernel to cache data in memory for faster access and reduces the amount of data being swapped in and out of swap space at any given time. Simply open /etc/sysctl.conf in a text editor with root permissions, then append the following line to the bottom of the file:

vm.swappiness=10

(You will need to restart the session in order for your changes to take effect.) You can tweak this value to see how performance improves. The lower the value, the less you use swap space and the more data is cached to memory. This was the value that seemed to work best with our test system using 512MB RAM. However, this tip isn't just restricted to systems with large amounts of memory - systems with 256MB of RAM or less may see a performance boost if swappiness is increased, as this will cache more data to swap space and free up more memory for day-to-day applications.

The precise values vary from system to system so this will require some trial and error, especially as reading data from swap space still takes longer than reading it from memory, but the end results are usually worth the effort.

Speed up ext3

You can gain some significant performance benefits by enabling write-back operation in ext3. This tweak isn't restricted to systems running KDE, but it is disabled by default in almost every distro. This is primarily because older hard drives don't support this feature, though newer hard drives can achieve a minor speed boost. This won't affect your day-to-day disk operations, so it is not recommended you try this tweak on a typical home system, but you will see an improvement for the high intensity disk operations that are typically the preserve of servers.

After making a back up of the file, open /etc/fstab in a text editor with root permissions and look for a line with the following section of text:

relatime,errors=remount-ro

and replace it with this:

noatime,nodiratime,errors=remount-ro,data=writeback

If there is no text either side of this snippet, you have done it wrong! Save and exit this file then open /boot/grub/menu.lst and find the following two lines:

# defoptions quiet splash
#altoptions=(recoverymode) single

They won't be next to each other, but once you find them append the following at the end of both those lines:

rootflags=data=writeback

then save and exit. Open up a root terminal and run update grub . You then have the option of simply restarting to apply these changes to your file system, or you can apply them on the fly by installing tune2fs from your package manager. If you choose the latter option you would then type the following into a root terminal:

tune2fs -o journal_data_writeback /dev/hda1

substituting /dev/hda1 with your root partition. Be warned: write-back mode puts you at a little risk of losing data if you machine suddenly powers off, ie if you kick the power cord out, if there's a major system crash or if you get a general power outage.

Voice of the Guru #1

Richard Stallman - founder of the GNU Project

"I recently learned about the M-. command in Bash (use Escape followed by a full stop if you don’t have a Meta key), which copies the last argument from the previous command."

分享到:
评论

相关推荐

    VB编程资源大全(英文控件)

    &lt;END&gt;&lt;br&gt;28,ColorProgressBar.zip&lt;br&gt;Replaces the standard progress bar with one that is on the order of O(n^2) times faster, with color options, and directional options.&lt;END&gt;&lt;br&gt;29,MDITaskBarDemo.zip...

    Visual C++ 编程资源大全(英文源码 表单)

    1,01.zip&lt;br&gt;MFC Extension Library&lt;br&gt;MFC扩展界面库, 使用Visual C++ 6.0(15KB)&lt;END&gt;&lt;br&gt;2,02.zip&lt;br&gt;Visual Studio style UI&lt;br&gt;Visual Studio风格的界面效果(15KB)&lt;END&gt;&lt;br&gt;3,03.zip&lt;br&gt;Internet Explorer 4 ...

    DIBSection Class VB

    &lt;br&gt;&lt;br&gt; m_hDC = CreateCompatibleDC(0) &lt;br&gt; If (m_hDC &lt;&gt; 0) Then &lt;br&gt; If (CreateDIB(m_hDC, lWidth, lHeight, m_hDIb)) Then &lt;br&gt; m_hBmpOld = SelectObject(m_hDC, m_hDIb) &lt;br&gt; Create = True &lt;br&gt; Else &lt;br...

    Using DIB Sections in VB

    &lt;br&gt;&lt;br&gt; m_hDC = CreateCompatibleDC(0) &lt;br&gt; If (m_hDC &lt;&gt; 0) Then &lt;br&gt; If (CreateDIB(m_hDC, lWidth, lHeight, m_hDIb)) Then &lt;br&gt; m_hBmpOld = SelectObject(m_hDC, m_hDIb) &lt;br&gt; Create = True &lt;br&gt; Else &lt;br...

    VB编程资源大全(英文源码 控件)

    YOu can change the ToopTip and images in RunTime, this will make it easy to make a flashing icon to get the users attention.&lt;END&gt;&lt;br&gt;15 , ExcellOS.zip&lt;br&gt;This is a fake Operating System &lt;END&gt;&lt;br&gt;16 ,...

    VB编程资源大全(英文源码 数据库)

    ClassBuilder1.zip&lt;br&gt;Class Builder - reads SQL Server or Access database and creates a class of the selected table&lt;END&gt;&lt;br&gt;6 , adoView1.zip&lt;br&gt;ADO viewer. Retrieve all columns, querys and fields of a...

    SQLite

    Its functionality lies between MySQL and PostgreSQL, however it is faster than both databases.&lt;br&gt;&lt;br&gt;In SQLite, author Chris Newman provides a thorough, practical guide to using, administering and ...

    狗目标检测数据集VOC-xml格式100张.zip

    `&lt;bndbox&gt;`标签内的`&lt;xmin&gt;`, `&lt;ymin&gt;`, `&lt;xmax&gt;`, `&lt;ymax&gt;`分别代表边界框的左上角和右下角的像素位置。 利用这个数据集,研究人员和开发者可以训练深度学习模型,如Faster R-CNN、YOLO(You Only Look Once)或...

    目标检测数据集:遥感卫星图像检测(xml标注)

    其中,`&lt;filename&gt;`指定了图像文件名,`&lt;size&gt;`包含了图像的宽、高和通道数,`&lt;object&gt;`标签下的`&lt;name&gt;`表示目标类别,`&lt;bndbox&gt;`则给出了目标的边界框坐标(`&lt;xmin&gt;`, `&lt;ymin&gt;`, `&lt;xmax&gt;`, `&lt;ymax&gt;`),描述了目标...

    VOC硬币数据集xml格式

    &lt;difficult&gt;0或1(是否为困难样本)&lt;/difficult&gt; &lt;bndbox&gt; &lt;xmin&gt;边界框左上角X坐标&lt;/xmin&gt; &lt;ymin&gt;边界框左上角Y坐标&lt;/ymin&gt; &lt;xmax&gt;边界框右下角X坐标&lt;/xmax&gt; &lt;ymax&gt;边界框右下角Y坐标&lt;/ymax&gt; &lt;/bndbox&gt; &lt;/...

    cuteEditor6.0

    You can also create your own policy files that define arbitrary permission sets.&lt;br/&gt;&lt;br/&gt;Comparison of the sample security policy file &lt;br/&gt;&lt;br/&gt; &lt;br/&gt;Permissions/Resource Setting Admin Default ...

    图片打标签程序windows_v1.3.0.zip

    在上述例子中,`&lt;name&gt;`元素表示物体类别(如"car"),而`&lt;bndbox&gt;`元素则包含了物体边界框的坐标(`&lt;xmin&gt;`、`&lt;ymin&gt;`、`&lt;xmax&gt;`、`&lt;ymax&gt;`)。这样的标注数据对于训练深度学习模型,如YOLO(You Only Look Once)...

    LabelImg图像标记.rar

    &lt;name&gt;class1&lt;/name&gt; &lt;pose&gt;Unspecified&lt;/pose&gt; &lt;truncated&gt;0&lt;/truncated&gt; &lt;difficult&gt;0&lt;/difficult&gt; &lt;bndbox&gt; &lt;xmin&gt;100&lt;/xmin&gt; &lt;ymin&gt;50&lt;/ymin&gt; &lt;xmax&gt;200&lt;/xmax&gt; &lt;ymax&gt;150&lt;/ymax&gt; &lt;/bndbox&gt; &lt;/object...

    目标检测标注工具labelImg

    &lt;path&gt;C:\path\to\image.jpg&lt;/path&gt; &lt;source&gt; &lt;database&gt;Unknown&lt;/database&gt; &lt;/source&gt; &lt;size&gt; &lt;width&gt;640&lt;/width&gt; &lt;height&gt;480&lt;/height&gt; &lt;depth&gt;3&lt;/depth&gt; &lt;/size&gt; &lt;segmented&gt;0&lt;/segmented&gt; &lt;object&gt; ...

    HTML5小蝌蚪组成心形动画特效.zip

    &lt;label for="friction"&gt;friction &lt;span&gt;(f&gt;1: faster, faster! f&lt;1: slow....)&lt;/span&gt;&lt;/label&gt;&lt;br /&gt; &lt;input id="friction" value=".9" min="0.5" step="0.05" ...

    基于pytorch框架的Faster-RCNN模型python源码+项目说明+数据集.zip

    1、写入训练的txt文件 &lt;br&gt; &ensp;&ensp; 修改configs包下面的config文件中三个属性 &ensp;&ensp; 然后根据自己的数据集的标注文件是怎么个形式选择执行data包下面process_data.py文件中的两个方法。 &lt;br&gt; &ensp;&...

    DevExpress CodeRush 3.0.5 with Refactor! Pro (1/3)

    * Clipboard Tools - The clipboard as your trusty sidekick because a smart clipboard is a whole lot better than a simple one.&lt;br&gt; * Navigation Tools - Move through source code faster because fishing ...

    行人跌倒数据集 跌倒检测_fall.rar

    经典的模型如YOLO(You Only Look Once)、SSD(Single Shot Multibox Detector)或Faster R-CNN等都可以被用于目标检测任务,通过网络学习来识别和定位跌倒事件。同时,考虑到跌倒检测的动态特性,也可以考虑使用...

    DevExpress CodeRush 3.0.5 with Refactor! Pro (2/3)

    * Clipboard Tools - The clipboard as your trusty sidekick because a smart clipboard is a whole lot better than a simple one.&lt;br&gt; * Navigation Tools - Move through source code faster because fishing ...

Global site tag (gtag.js) - Google Analytics