Pages - Menu

Friday, October 17, 2008

Swappiness

I was reading through the Ubuntu Swap FAQ, and thought I'd make a note on swappiness, which is a configurable value of how much the system should rely on swap space instead of real RAM. Personally, I wish my the computer would never use swap. From the FAQ:
  • swappiness can have a value of between 0 and 100

  • swappiness=0 tells the kernel to avoid swapping processes out of physical memory for as long as possible

  • swappiness=100 tells the kernel to aggressively swap processes out of physical memory and move them to swap cache

  • Ubuntu uses a default setting of swappiness=60

To check the swappiness of your system, at a terminal:
cat /proc/sys/vm/swappiness

A temporary change (lost at reboot) can be made with:
sudo sysctl vm.swappiness=10

To make the changes permanent, edit this file:
sudo gedit /etc/sysctl.conf

And edit the value
vm.swappiness=10
(if this value doesn't exist, create it at the end of the file)

Changes will apply at next reboot.

1 comment:

Unknown said...

Actually, you can use sysctl -p to load it from /etc/sysctl.conf without rebooting!