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
The default setting in Linux is swappiness=60. Reducing the default value of swappiness will probably improve overall performance for a typical desktop installation. A value of swappiness=10 is recommended, but feel free to experiment.
To check the swappiness value use command: cat /proc/sys/vm/swappiness
To make a change permanent, edit the configuration file with your favorite editor:
vi /etc/sysctl.conf
and add following parameter to the end of the file like so:vm.swappiness=10Save the file and reboot.
Still, there are users who insist that, for example, a system backup should never force OpenOffice out to disk. They don't care how quickly a system maintenance application runs at 3:00 in the morning, but they care a lot about how the system responds when they are at the keyboard. This wish was expressed repeatedly until Andrew Morton exclaimed:
I'm gonna stick my fingers in my ears and sing "la la la" until people tell me "I set swappiness to zero and it didn't do what I wanted it to do.
2 comments:
' sysctl -p ' as root will load the settings, so, if you make changes, a reboot is not needed.
see the manpage for sysctl.
No, "sysctl -p" will reload values from ie. /proc/..../vm.swappiness in memory, but after that checking /etc/sysctl.conf it was NOT there (`uname -a` says "Linux raippa 2.6.26-2-686 #1 SMP Mon Aug 30 07:01:57 UTC 2010 i686 GNU/Linux" and it's Debian Lenny... Only way to have it working after boot really is to modify sysctl.conf by myself all other tests are temporary.
Post a Comment