Maximize Desktop Speed
No Prelink Needed in Ubuntu or Debian?
Recent Ubuntu and Debian distributions include a different mechanism for speeding application loading and a new linking mechanism that speeds up the linking process without using prelink.
To enable the faster startup times, do sudo apt-get install preload, and from that moment on, Linux monitors which applications you run and fetches those binaries and libraries into memory.
For example, if you use Firefox and OpenOffice.org every day, preload will determine that those two are common applications and will keep the needed libraries in RAM. Of course, should you change to Seamonkey and KOffice, preload eventually will detect your change of habits and do the appropriate thing.
Every time you create, modify or simply access a file, Linux dutifully records the current timestamp in its directory structures. In particular, the latter update obviously implies a penalty on file access time. Even if you merely read a file (without changing anything), Linux updates the file's inode (see Resources for more on inodes) with the current timestamp. Because writes obviously require some time, doing away with these updates results in performance gains.
In order to achieve this enhancement, you need to change the way the filesystem is mounted. Working as root, do cat /etc/fstab to get the following:
/dev/hda1 /boot ext2 acl,user_xattr 1 2 /dev/hda2 swap swap defaults 0 0 /dev/hda3 / reiserfs acl,user_xattr 1 1 /dev/hdd1 /media/disk2 reiserfs defaults 1 2 /dev/hdc /media/cdrom udf,iso9660 ro,user,noauto 0 0 proc /proc proc defaults 0 0 sysfs /sys sysfs noauto 0 0 debugfs /sys/kernel/debug debugfs noauto 0 0 usbfs /proc/bus/usb usbfs noauto 0 0 devpts /dev/pts devpts mode=0620,gid=5 0 0
Given this output, the best candidates for the optimization are / and /dev/hdd1; /boot is used only when booting, /swap is out of bounds for you, and the others are not hard disks.
Making the change is simple. With your favorite text editor, add ,noatime to the options in the fourth column. When you are done, issue the mount -a command to remount all partitions, and then issue a plain mount to check whether the changes were done (Listing 2).
Listing 2. Checking the New Parameters with mount
$ mount -a $ mount /dev/hda3 on / type reiserfs (rw,noatime,acl,user_xattr) proc on /proc type proc (rw) sysfs on /sys type sysfs (rw) debugfs on /sys/kernel/debug type debugfs (rw) udev on /dev type tmpfs (rw) devpts on /dev/pts type devpts (rw,mode=0620,gid=5) /dev/hda1 on /boot type ext2 (rw,acl,user_xattr) /dev/hdd1 on /media/disk2 type reiserfs (rw,noatime)
Notice the noatime parameters in the /dev/hda3 and /dev/hdd1 lines. Those mean you did everything right, and access times are no longer being recorded.
By the way, if you research this on the Web, you may find a reference to another option, nodiratime, which has to do with directories. Do not bother setting this option, because noatime implies nodiratime.
I ran some tests (creating lots of files, and copying them to /dev/null) and timed the results both with and without the noatime option and found some small performance enhancements—every little bit helps.
Now, if you gotten this far, you're ready for the big one: enhancing your kernel.
Data Integrity vs. Speed?
Googling for filesystem performance enhancements, you might come upon a suggestion for ext3 and ReiserFS, involving another mounting option: data=writeback. This option effectively undoes the advantage of those two filesystems by partially disabling their journaling. (Journaling is what ensures that your data won't be lost, even after a system crash.) If you include data=writeback, you'll gain an increase in speed at the cost of having old data show up after a crash. I don't like this kind of risk, so I don't use that option.
All the tweaks we have done so far are just part of the job, and you even can get a bit more speed if you recompile your kernel and adjust it optimally for your specific hardware and needs. Note that even though compiling a full kernel isn't the challenge it used to be (mainly you just have to make a few choices and key in some commands), there still is room for botching things up. Don't try this unless you feel comfortable.
Most distributions usually provide a one-size-fits-all kernel compiled with the most generic options, which should work for everybody. Of course, this won't necessarily fit your specific case. If your box has an Athlon XP CPU (as my laptop does), or many processors, or a certain graphics card, the generic kernel won't take advantage of them. What to do? You can tweak some kernel options and recompile it for optimal performance. Here, I pay specific attention to the options that enhance speed and responsiveness.
|Dynamic DNS—an Object Lesson in Problem Solving||May 21, 2013|
|Using Salt Stack and Vagrant for Drupal Development||May 20, 2013|
|Making Linux and Android Get Along (It's Not as Hard as It Sounds)||May 16, 2013|
|Drupal Is a Framework: Why Everyone Needs to Understand This||May 15, 2013|
|Home, My Backup Data Center||May 13, 2013|
|Non-Linux FOSS: Seashore||May 10, 2013|
- RSS Feeds
- Making Linux and Android Get Along (It's Not as Hard as It Sounds)
- Using Salt Stack and Vagrant for Drupal Development
- Dynamic DNS—an Object Lesson in Problem Solving
- New Products
- Validate an E-Mail Address with PHP, the Right Way
- Drupal Is a Framework: Why Everyone Needs to Understand This
- A Topic for Discussion - Open Source Feature-Richness?
- Download the Free Red Hat White Paper "Using an Open Source Framework to Catch the Bad Guy"
- Tech Tip: Really Simple HTTP Server with Python
- Keeping track of IP address
24 min 53 sec ago
- Roll your own dynamic dns
5 hours 38 min ago
- Please correct the URL for Salt Stack's web site
8 hours 49 min ago
- Android is Linux -- why no better inter-operation
11 hours 5 min ago
- Connecting Android device to desktop Linux via USB
11 hours 33 min ago
- Find new cell phone and tablet pc
12 hours 31 min ago
14 hours 32 sec ago
- Automatically updating Guest Additions
15 hours 9 min ago
- I like your topic on android
15 hours 55 min ago
- This is the easiest tutorial
22 hours 31 min ago