Modify the swappiness of the Linux swap space to reduce the cache on the hard disk

Source: Internet
Author: User

(2010-01-12 17:21:31) reproduced
Tags: swap swappiness it Category: Linux

Linux uses a portion of the hard disk as a swap partition for process scheduling--the process is a running program--standby the currently unused process to ' wait ', or even ' sleep ', once it is used and then adjusted to ' Active ', the process of sleeping sleeps in the swap zone, emptying the memory out of the ' activity ' process.
If the memory is large enough, you should tell Linux not to use SWAP partitions too much, and you can modify the value 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 Ubuntu, the default setting swappiness this value equals 60.
  
!!!! If the memory is small, and the process is scheduled frequently, the hard disk will be loud!!!!
  
Now generally 1 g of memory can be modified to 10, 2 G can be changed to 5, or even 0. Specifically, do this:
1. Check the swappiness in your system
$ cat/proc/sys/vm/swappiness
No accident, you should see it's 60.
2. Modify the 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 of 60, for peace and stability, but also further:
$ sudo gedit/etc/sysctl.conf
Add such a line at the end of this document:
vm.swappiness=10
Then save, restart. OK, your settings are in effect.

Modify the swappiness of the Linux swap space to reduce the cache on the hard disk

Related Article

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.