Tuesday, September 8, 2009

Frugal configuration for an optimal performance Ubuntu Linux desktop

Further to the kernel reconfiguration done earlier, I continued my quest to make life better with the limited resources on my seven year old PC with just 512MB DDR RAM. These things helped reduce total memory consumption and thrashing:

Choosing leaner desktop environment
While fvwm was the leanest, it was provided crappiest user experience. More so after you are used to GNOME or Windows. I did not have enough patience to customize fluxbox to the nth degree to come up with an acceptable set. Using it with iDesk made life a bit easier; but still laborious to keep creating those icons for commonly used applications. I felt as if I had deprived myself of something. WindowMaker (WM) and Xfce provided more acceptable, closer-to-GNOME GUI in that order. Needed to add a taskbar and notification area using perlpanel under WM environment. The real turn-off with WM was its inability to properly show OpenOffice.org Spreadsheet. Though Xfce is not as lean as WM, it is still leaner than GNOME and yet provides almost similar functionality as GNOME. Interestingly, I found application response (GUI update) was faster with Xfce than even fluxbox!

Kernel tunable parameters
swappiness: reduced the default value 60 to 40. More memory available for applications and less greediness in dedicating it for buffers/ cache. Resulting in lesser swap out. I open multiple programs and my usage needs frequent switch between them; hence this choice. I read in [2, 3] that for I/O intensive applications, more aggressive value is recommended.

Useful references
  1. Reduce your Linux memory footprint
  2. 2.6 swapping behavior 
  3. Linux: Tuning Swappiness

Saturday, August 22, 2009

Compiling and installing latest stable Linux kernel for Ubuntu

Just finished installing the latest stable Linux kernel on my PC running Ubuntu. It was not a tedious experience at all as some had hinted earlier. Primarily, thanks to the instructions available at Ubuntu forum:


The procedure mentioned there is compatible with 'deb'. Though I have used Linux for software development for some time now, I am still a newbie for hands-on administration. This was my first ever experience with building and installing the kernel.

Few optimizations I applied using 'make xconfig'
  • chose specific processor instead of the existing 'generic 686' and disabled SMP stuff (CONFIG_SMP not defined)
  • changed timer interrupt frequency from 250 to 1000 Hz (CONFIG_HZ_1000=y) for increased responsiveness
  • disabled support for lots of vendor hardware I knew I will never have: laptops, backlit display, touchscreen, etc.
  • opted out unwanted file systems
  • disabled lots of debug stuff--this one is not for meant for development
  • opted out ATM stuff from networking support. Yes, I know what I am doing! Left most of the rest unchanged. Don't have the patience for now to make sure... Perhaps I could have turned off routing, some rarely used QoS schedulers, etc. It's just a poor desktop PC.
Perceived improvements in experience
Kernel build time:
Removing unwanted stuff also saved compilation time by about an hour, that too, with 'nice -n 5 make make-kpkg ...'. Did not really want to simply watch the build happen. It allowed using the PC for normal daily usage. Without nice, even GDM failed to respond when I wanted to switch user :-).
Kernel image size:
3.4M vmlinuz-2.6.28-14-generic
7.3M initrd.img-2.6.28-14-generic
2.4M vmlinuz-
6.4M initrd.img-
Memory savings: (free -m)
12MB more user RAM available upon shell load
6M more buffered RAM available
Application performance:
OpenOffice Writer load time reduced by 1.25 seconds
Bootup time reduction by 1.57s
Shutdown time reduction by 3.1s

Mouse, bash output and other UI interactions seem a bit more responsive.

Nothing is known to be broken while using the freshly compiled kernel, yet :-)

Plus, now I know what is running in the kernel for having created .config from scratch before kernel code compile. Happier :-)