CentOS retains some physical memory

Source: Internet
Author: User
By default, Linux reserves a lot of space for caching (almost all) for accelerating file IO. When a large number of reads and writes occur in the system, the page cache often consumes physical memory. although there is no danger of swap to the hard disk, it is always uncomfortable to look at the full physical memory. The kernel parameter below ensures that a portion of the physical memory is reserved without being eroded by the cache. Because the remaining memory reaches this value, the memory will be forcibly recycled. because the cache priority is low, the memory will be recycled first.

By default, Linux reserves a lot of space for caching (almost all) for accelerating file IO. When a large number of reads and writes occur in the system, the page cache often consumes physical memory. although there is no danger of swap to the hard disk, it is always uncomfortable to look at the full physical memory.

The kernel parameter below ensures that a portion of the physical memory is reserved without being eroded by the cache. Because the remaining memory reaches this value, the memory will be forcibly recycled. because the cache priority is low, the memory will be recycled first.

The default parameters are as follows:

  # Vm. min_free_kbytes = 67584

 

The 67584kb is converted to 66 MB, which means that the system only reserves MB of physical memory. This parameter can be expanded to make the physical memory more idle, for example, 1G idle.

 

  VMS. min_free_kbytes = 1048576

 

In my opinion, this parameter applies to applications such as file/web/cache.

 

Exercise caution when using a machine with high memory pressure, because OOM (out of memory, memory overflow) may occur if the cache is still insufficient after it is recycled, and serious system crashes may occur. High Memory pressure refers to the amount of memory occupied by programs, such as databases and large applications.

 

Generally, if the page cache of the machine occupies a large proportion, the memory pressure on the machine is not high.

 

There is also a kernel parameter, vm. drop_caches, default value

  Vm. drop_caches = 0

 

Optional values:

0: Do not delete

1. delete page cache

2. delete page cache and buffer cache

3. delete all caches

 

If this parameter is enabled, it is crude. in addition to the cache being used by the program, the other parameters are automatically deleted. It is best to manually sync and refresh dirty data to the hard disk, otherwise there may be a risk of data loss.

 

In contrast, vm. min_free_kbytes is more ambitious. it controls the cache size, and the cache is passively deleted.

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.