What is swappiness and why the heck should I change it?
swappiness is a value between 0 and 100 which controls the priority of your system using ram vs. swap.
Making this change will greatly increase the performance of your box! Especially if you have a recent system with lots of ram.
A swappiness value of 0 means avoid swap as much as possible and only use ram.
A swappiness value of 100 means avoid ram as much as possible and only use swap.
By default, Ubuntu is set for swappiness of 60.
For desktop users I recommend changing swappiness to a value of 10.
For most servers I suggest setting it to a value of 25.
If you have 4, 8, or more GB of ram, consider setting your swappiness to 0.
Ok, so how to I check my swappiness?
Do this command to check your current swappiness value:
You can temporarily change it by issuing:
sudo sysctl vm.swappiness=10
To set the value permanently on your box, edit this file:
sudo nano /etc/sysctl.conf
And put in the value you desire, such as: