CentOS, Cleanup cache (drop_caches)

Source: Internet
Author: User

when reading and writing files, To improve read and write efficiency and speed, the Linux kernel caches files in memory, which is the cache memory.


cat/proc/sys/vm/drop_caches
0 Span style= "Font-family:arial;font-size:14px;line-height:26px;white-space:pre;background-color:rgb (255,255,255) ;" > //default is 0 ; 1-Empty page cache, 2-empty inode and directory tree cache, 3-empty all caches

Most GNU Linux is enabled by default caching mechanism, viewing the configuration file cat/proc/sys/vm/drop_caches if 0, it means that the caching mechanism is turned on, this mechanism is very effective when running a service, convenient for the service itself to read quickly, As a desktop user, the open program is not so single, so the desktop users are recommended to set this profile is 1, timely clean up the system cache, freeing up space for other programs to use.

[email protected] ~]#Sync//Note: Use the sync command to synchronize data to disk before emptying the cache
[email protected] ~]#free-m
Total used free shared buffersCached
mem:15898 3029 12869 0 1911064
-/+ buffers/cache:1772 14125
swap:31999 0 31999
[email protected] ~]#Echo 3>/proc/sys/vm/drop_caches
[email protected] ~]#free-m//Discovery cache significantly reduced
Total used free shared buffersCached
mem:15898 1770 14128 0 1 -
-/+ buffers/cache:1738 14160
swap:31999 0 31999


To clean up the cache script:

#! Bin/bash

Sync

Sync

Echo 3 >/proc/sys/vm/drop_caches

This article is from the "Dream to Reality" blog, please be sure to keep this source http://lookingdream.blog.51cto.com/5177800/1859445

CentOS, Cleanup cache (drop_caches)

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.