The swappiness parameter configures how often your system swaps data out of RAM to the swap space. This is a value between 0 and 100 that represents a percentage.
Interactions with the swap file are “expensive” in that they take a lot longer than interactions with RAM and they can cause a significant reduction in performance.
With values close to zero, the kernel will not swap data to the disk unless absolutely necessary.
Values that are closer to 100 will try to put more data into swap in an effort to keep more RAM space free.
In other words, the higher the vm.swappiness value, the more the system will swap.
Current value:
cat /proc/sys/vm/swappiness
To make change permanent - add to /etc/sysctl.conf:
vm.swappiness=10
Another related value that you might want to modify is the vfs_cache_pressure. This setting configures how much the system will choose to cache inode and dentry information over other data.cat /proc/sys/vm/vfs_cache_pressure
For permanent config add to /etc/sysctl.conf:
vm.vfs_cache_pressure=50