Ubuntu performance tuning is pretty easy – most of the hard work has already been done by Canonical and the Ubuntu community. There are a few places where default settings are not optimal for desktop users, and swappiness is one of those. In the case of swappiness, the default Ubuntu setting is for a server which likely has lots of process that use small amounts of memory.
If you have less than 4GB of memory, Ubuntu’s default swappiness of 60 is probably causing your computer to start swapping to disk prematurely and slowing things down. You can quickly tell if this is the case using top (or even better htop) and looking at the memory and swap amounts. If you have used less than 80% of your system’s memory and see a largish number in swap, you’ll benefit by changing swappiness.
If you have more than 4GB, a swappiness of 60 may not be the right setting… it depends on what you do with your system. If you are tuning a server, the answer is, it’s complicated and depends on stuff. This LWN article does a great job of explaining how swappiness works Linux swapping and swappiness works.
To see your current swappiness:
$ cat /proc/sys/vm/swappiness
To set swappiness on your system, follow these instructions.