Tune swap settings in Linux

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.
Basically, this is access data about the filesystem. This is generally very costly to look up and very frequently requested, so it’s an excellent thing for your system to cache.
Get current setting:
cat /proc/sys/vm/vfs_cache_pressure
For permanent config add to /etc/sysctl.conf:
vm.vfs_cache_pressure=50