[Linux] Who's consuming our cache under Linux?

Source: Internet
Author: User
Tags git clone

First, Reason:

Ever see the MySQL server cache occupies a particularly large, in fact, we all know that this is reasonable, these are available memory;

So the question is, who is taking up the caches? If you remove an unreasonable cache footprint, the system memory will be used more fully.

       Total used       free     shared    buffers     cachedmem:         64309      55889        8420          0              43363-/+ buffers/cache:      12285      52024 Swap:         20479          0      20479

By the visible, the cache occupies 42G of memory, a very scary look. In fact he belongs to the Memfree. For specific instructions, you can see here:

http://www.linuxatemyram.com/.

Second, the solution:

Here are two tools to see if a file occupies the page Cache and how much it occupies: Fincore and Vmtouch

1, Fincore

This is part of the Linux-ftools tool, you give the file (folder) name as input, he will tell you how many of his files (data) are cached by the system.

Because not very will install, here do not recommend, concrete look here https://code.google.com/p/linux-ftools/.

2, Vmtouch

  Vmtouch can check the cached files and directories, push the files into the cache and evict the files in the cache, and so on. ( recommended )

Installation method:

$ git clone https://github.com/hoytech/vmtouchmakesudo  makeInstall

How to use:

$ vmtouchvmtouch:no files or directories Specifiedvmtouch v1.0.2-The Virtual Memory toucher by Doug hoyteportablefileSystem Cache Diagnostics and Controlusage:vmtouch [OPTIONS] ... FILES OR Directories ... Options:-TTouchpages into memory-e evict pages from memory-L Lock PagesinchPhysical Memory with Mlock (2)  -L Lock PagesinchPhysical Memory with Mlockall (2)  -d Daemon Mode-M MaxfileSize toTouch-p use the specified portion instead of the entirefile-F Follow Symbolic links-h also count hardlinked copies-W wait untilAll pages is locked (useful together with-d)-v Verbose-Q Quiet

Example:

1) View the in-memory cache of the/tmp directory:

$ vmtouch/tmp/vmtouch:WARNING:skipping nonfile:/tmp/ssh-ggjncekwmqc2/agent. 1068 7 4780/4780 18m/                      18M  0.001006 seconds          

For more information view, use the-v parameter for example: Vmtouch-v/tmp/

2) See how much a file has been cached:

$ vmtouch-v ~/downloads/phoronix-test-suite_6. 0  /home/neo/downloads/phoronix-test-suite_6. 0 . 1_all.deb[                                            0/ 1 0                    0/  0/528k  0 0.000117          Seconds

3. Cache the files:

$ VMTOUCH-VT ~/downloads/phoronix-test-suite_6. 0  /home/neo/downloads/phoronix-test-suite_6. 0  / 1 0                       (528K)         0.007935 seconds

4) evict data from the cache:

$ vmtouch-ve ~/downloads/phoronix-test-suite_6. 0  /home/neo/downloads/phoronix-test-suite_6. 0 . 1_all.deb            1   0 (528K)         0.000109 seconds          

Report:

Specific Information Reference official website: https://hoytech.com/vmtouch/

Another reference page: Vmtouch:portable File Cache Analyzer

  

[Linux] Who's consuming our cache under Linux?

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.