Swappiness=0__linux of Linux swap space

Source: Internet
Author: User
Linux uses a portion of the hard disk as a swap partition for process scheduling--the process is a running program--tune the currently unused process to ' wait (standby) ', or even ' sleep ', once it is used, and then tuned to ' Activities (Active) ', the process of sleep lying to the swap partition, the memory empty out to the ' activity ' process.
If the memory is large enough, you should tell Linux not to use the SWAP partition too much, and you can modify the Swappiness value. Swappiness=0 the maximum use of physical memory, and then the swap space, swappiness=100 when the positive use of the swap partition, and the memory of the data in a timely manner into the swap space.
In Linux, the default setting swappiness this value is equal to 60.

  
Now generally 1 g of memory can be modified to 10, 2 G can be changed to 5, or even 0. To do this specifically:
1. View the swappiness in your system
$ cat/proc/sys/vm/swappiness
No surprises, you should see it's 60.
2. Modify Swappiness value to 10
$ sudo sysctl vm.swappiness=10
But this is only a temporary change, after you restart the system will restore the default 60, for long-term stability, but also to further:
$ sudo gedit/etc/sysctl.conf
At the end of this document, add this line:
vm.swappiness=10
Then save and reboot. OK, your settings are in effect.

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.