Adjust swap usage with swappiness kernel parameters

Source: Internet
Author: User

In Linux, you can improve the performance of your system by modifying the Swappiness kernel parameters to reduce the system's use of swap.

The problem is this, after the release of the new version of the product, hourly memory usage will have a spike. Although this peak is far from reaching the server's physical memory, it is true that the system starts using swap when memory usage peaks. In the swap process, the performance of the system decreases, showing a large service delay. In this case, you can reduce the system's use of swap by adjusting the swappiness kernel parameters to avoid the performance impact of unnecessary swap.

In short, this parameter defines the system's propensity to use swap, with the default value of 60, and the larger the value, the more likely it is to use swap. can be set to 0, this does not prohibit the use of swap, but minimizes the possibility of using swap.

The current settings of the parameters can be viewed by sysctl-q vm.swappiness.

The way to modify the parameters is to modify the/etc/sysctl.conf file, add the vm.swappiness=xxx, and restart the system. This action is equivalent to modifying the/proc/sys/vm/swappiness file in the virtual system and changing the value to XXX values.

If you do not want to restart, you can dynamically load the/etc/sysctl.conf file via Sysctl-p, but it is recommended that you clear swap before doing so.

Adjust swap usage with swappiness kernel parameters

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.