swappiness on Ubuntu Desktop 11.10

Some things are surprising. My system has been feeling sluggish and I've been cleaning out stuff, fixing things, etc to make things more peppy on my 2 year old netbook which has been upgraded to each new version of Ubuntu Desktop. I was looking at the output of the free command a couple of days ago and found something odd. It showed swap being used. Not much, but I still had currently free memory. I know that can happen, but I was curious anyway.

Since the tendency to swap things out is controlled by the swappiness system variable I took a look and found it was set to 60 out of 100. I did some more searching and found the SwapFaq on help.ubuntu.com.

Interesting reading. It suggests that for a desktop a value of 10 is great.

You can check your swappiness by running


cat /proc/sys/vm/swappiness

or

sudo sysctl vm.swappiness

To change the setting, I like to use the sysctl command but you can also cat into the proc file mentioned above.


sudo sysctl vm.swappiness=10

Make it permanent by adding/setting vm.swappiness=10 in /etc/sysctl.conf.

I made the change and the system has not been taking as long when switching between tasks. What surprises me is that the FAQ suggests this is a good setting for a desktop, but Ubuntu Desktop still ships with swappiness=60.

\@matthias