The swappiness parameter controls the tendency of the kernel to move processes out of physical memory and onto the swap disk. What is the default setting and how to configure that to improve overall performance?
The Linux kernel provides a tweakable setting that controls swappiness
$ cat /proc/sys/vm/swappiness 60
/etc/sysctl.conf as root. Then, change or add this line to the file:
vm.swappiness = 10
for changing the swappiness value temporarily try this command:
$ echo 50 > /proc/sys/vm/swappiness
You could set this value in a virtual file
The mentioned value will be deciding how the swap space should be used, below are the values with their intents.
vm.swappiness = 0 # Swap is disabled. In earlier versions, this meant that the kernel would swap only to avoid an out of memory condition, but in later versions this is achieved by setting to 1. vm.swappiness = 1 # Kernel version 3.5 and over, as well as kernel version 2.6.32-303 and over: Minimum amount of swapping without disabling it entirely. vm.swappiness = 10 # This value is sometimes recommended to improve performance when sufficient memory exists in a system, this value *10* could be considered for the performance being expected. vm.swappiness = 60 # The default value. vm.swappiness = 100 # The kernel will swap aggressively.
Although it actually depends upon the need too, if the physical memory available is sufficient, there may not be a great need of swap space, in Layman's terms there won't be a need of changing the default value of
In RedHat/CentOS the default value is 60.
"In order to improve performance" is very broad term. What performance are you trying to improve?
Do you have issues with low memory?
Does your system SWAP when there's still free memory/cached memory?
In Linux free RAM = wasted RAM, so almost all free memory is used for disc caches.
There are cases with swappiness=60 where pages in memory are moved to SWAP if they haven't been accessed for extended time periods, no matter you have unallocated RAM.
Moving some memory pages to SWAP is not necessary a bad thing.
Please shed some more light on your issue for more detailed answer.