Swappiness

– Open a terminal
– type in or copy/paste:

sudo gedit /etc/sysctl.conf

– a file will be opened
– add the following line at the bottom of that file:

# Swappiness
vm.swappiness = 10
vm.vfs_cache_pressure = 50

– save the file and close it.

After rebooting the swappiness is set to 10. This can be checked by running the following command in a terminal:

sudo cat /proc/sys/vm/swappiness

References :

https://sites.google.com/site/tipsandtricksforubuntu/system-tips/swappiness
https://www.digitalocean.com/community/tutorials/how-to-add-swap-on-ubuntu-14-04