Tweaking Swappiness Setting in Linux
The default value setting for swappiness is 60. Meaning that the swap file will be used fairly often if the memory usage is around half of your RAM. Some suggested that reducing the default value of swappiness will probably improve overall performance for a typical Linux desktop installation. A value of swappiness=10 is recommended. The swap file will then only be used when my RAM usage is around 90 percent. Feel free to experiment.
To change the system swappiness value, open
/etc/sysctl.conf as root. Then, change or add this line to the file:
vm.swappiness = 10
Reboot for the change to take effect.
How do I configure swappiness? | Ask Ubuntu
Why most people recommend to reduce swappiness to 10-20? | Ask Ubuntu
Why is swappiness set to 60 by default? | Unix & Linux Stack Exchange