Linux system will wake up every time KSWAPD process, see if the memory is tense, if not nervous, then sleep, in the KSWAPD, there are 2 thresholds, pages_hige and Pages_low, when the number of free memory pages less than Pages_low, The KSWAPD process scans the memory and releases 32 free pages at a time, until the number of the zero page reaches Pages_high.
Linux in a large load (memory is very tight) when you generally see such two processes kswapd0 and KSWAPD1, if the process consumes a lot of system resources, especially in the RAC environment will cause system downtime, if the process occupies a very high resource, it is necessary to consider optimizing the system, or add hardware resources.
Linux uses a portion of the hard disk as a SWAP partition for process scheduling – the process is a running program – the process that is currently unused is tuned to ' Wait (standby) ', or even ' sleep ', once it is used and then transferred to ' active ', the sleep process is Swap partition, empty the memory out of the ' activity ' process.
If the memory is large enough, it should be told that Linux does not have to use Swap partitions too much and can be set by modifying the parameters of the swappiness. Swappiness=0 means to maximize the use of physical memory, then the swap space, swappiness=100 when the active use of the swap partition, and the memory of the data in a timely manner into the swap space.
In CentOS, the default value for Swappiness is 60.
You can see this by using the following command:
#cat/proc/sys/vm/swappiness 60
We can adjust the value of the swappiness to a suitable parameter, so as to achieve optimal use of Swap. Here we set it to 10.
Use the SYSCTL command:
#sysctl vm.swappiness=10 or #echo 0 >/proc/sys/vm/swappiness
But this is only a temporary change, after you restart the system will restore the default of 60, to permanently set up, but also need to modify the sysctl.conf in vim:
#vi/etc/sysctl.conf Add this line at the end of this document: # Search for the vm.swappiness setting. Uncomment and change it as necessary. vm.swappiness=10
This will take effect when the Swap partition is restarted.
This article is from the "Go Right on" blog, so be sure to keep this source http://caduke.blog.51cto.com/3365689/1600335
Swap, swappiness and kswapd0