Swap, swappiness and kswapd0

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.