Saturday, September 4, 2010

Speeding Up Debian GNU/Linux Desktop - Extreme Performance Tweaks

Why does a desktop, be it Linux or Windows, feel slow?

Because it tries to satisfy all - the vast majority of hardware and the varied requirements of a thousand different users. Result - heavier and sometimes heavily patched kernel, always running and sometimes never used services, and the unperceivable eye-candy that you don't care. Ok, now let's get on to the just right, optimized linux desktop. In the last post we have already talked how to do it on Windows).

SITUATION

  • Desktop hardware: D945GCLF essential board with Intel Atom 230 CPU embedded. 1GB physical RAM.
  • Operating System: Fully updated Debian GNU/Linux Lenny 5.0.5 with custom recompiled kernel

Note: Click on the screenshots to see their real sizes.

STEPS

Boot

Change boot timeout in /boot/grub/menu.lst to "0" if you've only one OS installed. I've changed timout to "2" and set default to "1" because my wife needs Windows in autoboot mode. Also, you should add "noresume" (if you don't boot from a resume/rescue partition) in the boot options to speed up booting a little further.



Filesystem

The default filesystem parameters in Linux lean more towards security/stability sometimes hampering performance. You can set "data_writeback" option to all the partitions using tune2fs utility, and add "noatime" option in /etc/fstab. It will speedup the file system.



As you can see in the above screenshot there is no entry for "swap" in my fstab. I've deliberately removed swap partition after observing no use for it on my bare usage. You may also delete the swap, if you have enough RAM (more than 1GB) and you never notice it to run out. Removing swap and using only physical memory speeds up overall responsiveness to a great extent.

Services

The please-all attitude of linux distributions make a default install littered with lots of services. You can disable/delete a few to gain dual benefit - faster boot and snappier desktop experience. On a debian system you can install sysv-rc-conf and uncheck (with caution) unnecessary services.



As you see in the screenshot, my desktop has just 11 services enabled.

Startup Programs

Modern linux desktop starts almost a dozen of startup programs (including bluetooth service, network applet, OpenOffice quickstarter, volume manager, accessibility, Bug reporter, update manager and a lot lot more) to please you. However, you use only a few of them, but your system suffers the toll in terms of memory and cpu usage. You can remove any or all of them as per your requirement.



As you see in the screenshot I've removed all the startup programs. I am using static IP settings (no need of network manager), I rarely use external storage media (no need for gnome-volume-manager, when needed I manually mount the external media), I have set my volume level (no need for that volume applet, when needed I will change settings in the media player/browser volume button)... bla.. bla... bla...

Eye-candy

Don't know about you, but I really don't like gnome-compositing, compiz, beryl, emerald or whatsoever the desktop effects are. Classic XP like look-n-feel is good for me. Even I prefer a desktop with no wallpaper to a pimpified desktop. Solid royal blue fillings on the desktop is enough.



Run gconf-editor (or use gconftool-2 on a terminal and change the settings) to enable "reduced_resources" (/apps/metacity/general/reduced_resources) and "accessibility" (/desktop/gnome/interface/accessibility) to get XP-ish like minimize-maximize effects and a snappier experience.




Speed Up /tmp

Move /tmp and /var/tmp to tmpfs in RAM. Add these two lines in /etc/fstab file

tmpfs /tmp tmpfs defaults,noatime,mode=1777 0 0
tmpfs /var/tmp tmpfs defaults,noatime,mode=1777 0 0

Also, speed up flash rendering in firefox by deleting the directory ~/.macromedia, then creating a symbolic link to /tmp as mentioned below.

rm -r ~/.macromedia
ln -s /tmp ~/.macromedia

After, all these changes done, you may reboot your system or just issue the following command in your terminal.

mount -o remount /


Kernel

Kernel is getting heavier and heavier, day by day, owing to ever-emerging desktop hardware and kernel hacks. It's daunting, but you can recompile a kernel just-right for your particular hardware.


As you see in above screenshot, I have recompiled a 2.6.32 kernel for Lenny. The recompiled kernel package weighed only 8MB and took 23.2MB of space after installation, where as the default Lenny 2.6.26 kernel weighted some 20MB and installed some 75MB on my HDD. Besides, the recompiled kernel is bears right settings for a desktop (default lenny kernel is optimized for servers) that on intel atom 230 processor. Recompilation also gave me options to disable swap, virtulization, esoteric/unused filesystem entries, and tons of unnecessary devices from being built into it.

4 comments:

Anonymous said...

Interesting choices/suggestions. Thanks for sharing them. A few there i had not previously considered, will give a try on one of my desktops. :)

Danilo said...

Please, can you make a step by step of how to compile a kernel in Debian? (or post a link of a post explaining this).

Danilo said...

Please, can you make a step by step of how to compile a kernel in Debian or send a link that explain how to do it?

manmath sahu said...

Danilo,

Kernel recompilation is already posted here in this blog.

http://pclinuxos2007.blogspot.com/2010/02/why-should-you-compile-your-kernel-and.html

Share your thoughts