September 2008

You are currently browsing the monthly archive for September 2008.

I’ve been using some form of Unix since I was introduced to the Internet my first year at University in 1995. I switched to Linux on the desktop full time in April 2005, and I’ve been managing my company’s mid-size network of servers and desktops for the past two years.

One thing I’ve noticed about Linux, even desktop-focused distributions, is that it’s largely tuned to the most desirable behaviour for a server. But what is desirable on a server isn’t necessarily desirable on a desktop. On Ubuntu Linux (or any Debian-based distro), add the following two lines to /etc/sysctl.conf:

vm.swappiness=1
vm.vfs_cache_pressure=50

These changes will be done automatically on reboot, but let’s load them now with:

sysctl -p

Now you’ll notice GUI applications feel more responsive and filesystem browsing will be faster when the disk is busy. What we have done is instruct the kernel to prefer to keep applications in RAM (swappiness) instead of disk cache, and to prefer to keep filesystem inodes and directory entries cached at the cost of files themselves. This means reading files from disk is slightly slower (IE, copying, moving, loading big files), but browsing the filesystem will be much faster.

Rudd-o.com wrote extensively on this last year. I recommend his write-up for anyone who wants to understand the issues in more depth.

For the record, I ran the tests in Rudd-o’s article. He advised creating a big file, then displaying the entire filesystem hierachy with find, and then copying that file. In my case, I went from 2 minutes, 6 seconds for the “find / > /dev/null” to just 17 seconds. That has made browsing in Konqueror a great deal faster.

Tags: