How to clean up memory and Cache in Linux

Source: Internet
Author: User

In Linux, frequent File Access by clearing memory and Cache methods will cause a significant increase in the system Cache Usage $ free-m total used free shared buffers cached Mem: 3955 3926 28 0 55 3459-/+ buffers/cache: 411 3544 Swap: 5726 0 5726 free memory reduced to dozens of megabytes, slow system running sync writes dirty content back to hard disk $ sync clears free cache $ echo 3>/proc/sys/vm/drop_caches by modifying drop_caches of proc System: writing to this will 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 this is a non-destructive operation, and dirty objects are notfreeable, the user shoshould run "sync" first in order to make sure allcached objects are freed. this tunable was Added in 2.6.16. modify/etc/sysctl. after the following option is added to the conf file, the vm will not be continuously added to the memory. 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 rough, so that the role of the cache is basically not available. Need to make appropriate adjustments based on machine conditions to find the best compromise source http://blog.lishixin.net/linux/1222.html

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.