Linux Cleanup Cache __linux

Source: Internet
Author: User
Tags flush

Clean up free cache by modifying the drop_caches of the proc system
$echo 3 >/proc/sys/vm/drop_caches

Drop_caches's detailed documentation is as follows:
Writing to this'll cause the kernel to drop clean caches, dentries and inodes from memory, causing that memory to become Free.
To free Pagecache:
* Echo 1 >/proc/sys/vm/drop_caches
To-free dentries and inodes:
* Echo 2 >/proc/sys/vm/drop_caches
To free Pagecache, dentries and Inodes:
* Echo 3 >/proc/sys/vm/drop_caches
As is a non-destructive operation, and dirty objects are notfreeable, the user should run "sync" a Ke sure allcached objects are freed.
This tunable is added in 2.6.16.

modifying/etc/sysctl.conf Adding the following options will not keep the memory growing
Vm.dirty_ratio = 1
Vm.dirty_background_ratio=1
vm.dirty_writeback_centisecs=2
Vm.dirty_expire_centisecs=3
Vm.drop_caches=3
Vm.swappiness =100
vm.vfs_cache_pressure=163
vm.overcommit_memory=2
VM.LOWMEM_RESERVE_RATIO=32 32 8
Kern.maxvnodes=3

The above settings are more brutal, so that the role of the cache can not play. It is necessary to adjust the condition of the machine to find the best compromise. /proc/sys/vm/dirty_ratio

This parameter controls the file system's filesystem write buffer size, in percent, representing the percentage of system memory, indicating that when the write buffer is used to the amount of system memory, the data is started to be written to disk. Increased use of more system memory for disk write buffering can also greatly improve the system's write performance. However, when you need a continuous, constant write situation, you should reduce its value, the general boot on the default is 10. Set 1 accelerator speed /proc/sys/vm/dirty_background_ratio

This parameter controls the Pdflush process of the file system and when the disk is refreshed. The unit is a percentage that represents the percentage of system memory, meaning that when the write buffer is used to the amount of system memory, Pdflush begins to write data to the disk. Increased use of more system memory for disk write buffering can also greatly improve the system's write performance. However, when you need a continuous, constant write situation, you should reduce its value, the general boot on the default is 5 /proc/sys/vm/dirty_writeback_centisecs

This parameter controls the running interval of the kernel's dirty data flush process Pdflush. Unit is 1/100 seconds. The default value is 500, which is 5 seconds. If your system is a continuous write action, it is better to actually lower this value, so that the peak of the write operation to be a lot of writing /proc/sys/vm/dirty_expire_centisecs

This parameter declares that the Linux kernel writes the "old" data in the buffer, and the Pdflush process begins to consider writing to disk. Unit is 1/100 seconds. The default is 30000, that is, 30 seconds of data, even if old, will refresh the disk. For a specially overloaded write operation, it is also good to reduce the value appropriately, but it does not shrink too much, because too much reduction can cause IO to improve too quickly. The recommended setting is 1500, which is 15 seconds old.
/proc/sys/vm/drop_caches
Release the cache that has been used
/proc/sys/vm/page-cluster
This file represents the number of pages written when you write to the swap area, 0 for 1 pages, 1 for 2, and 2 for 4 pages.
/proc/sys/vm/swapiness
This file represents the extent to which the system is exchanging behavior, and the higher the value (0-100), the more likely the disk swap will occur.
/proc/sys/vm/vfs_cache_pressure
This file represents the kernel's propensity to recycle cache memory for directory and Inode



/etc/sysctl.conf
Vm.dirty_ratio = 1
Vm.dirty_background_ratio=1
Vm.dirty_writeback_centisecs=1
Vm.dirty_expire_centisecs=3
Vm.drop_caches=3
vm.swapiness=100
vm.vfs_cache_pressure=133

Vm.dirty_ratio = 5 #dft 20%
Vm.dirty_background_ratio =5 #dft 10%
vm.dirty_writeback_centisecs=100 #dft 5s
vm.dirty_expire_centisecs=300 #dft 30000 is 30s
Vm.drop_caches=3 #dft 0
vm.swappiness=100 #dft 60
vm.vfs_cache_pressure=133 #dft 100

vm.min_free_kbytes=204800

#200M Mem

Save Simple Sysctl-w Net.ipv4.route.flush=1

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.