Linux in-memory cache analysis

Background
In the performance test, I used the top command to find that the memory cache reached about 4G. At that time, I was curious about what was cached. Then, according to the analysis, the log file is too large during the stress test, which causes the log to be cached.
In order to verify this result, first vi a large file at random, and then check whether the cache changes.
Then I looked for a tool to verify that the file was in that file.
Finally came to the conclusion: linux caches edited files.

Download address:
https://code.google.com/p/linux-ftools/The

official default source code, the line break is Windows, after downloading the source code, you need to modify the line break, otherwise the installation will report an error. You need to replace linux-ftools_modify.zip by yourself. The replacement of newlines has been completed.

Before packaging, modify the permissions and increase the permission to execute the script
chmod 755 -R *

Packaging instructions
./configure
make && make install

View cache commands (only valid for files in the current directory)
linux-fincore --pages=false --summarize --only-cached *
output
[root@dev-suning tmp]# linux-fincore --pages=false --summarize --only-cached *
filename size total_pages min_cached page cached_pages cached_size cached_perc
-------- ---- ----------- --------------- ---- -------- ----------- -----------
Could not mmap file: linux-ftools: No such device
Could not mmap file: linux-ftools -new: No such device
Could not mmap file: redis-2.8.19: No such device
wildfly-8.1.0.Final.tar.gz 115,995,207 28,320 0 28,320 115,998,720 100.00
---
total cached size: 115,998,720


Here is the screenshot

Just started When the cache is only 40M,


use the vi editor and open wildfly (about 110M)


Use the cache analysis tool to see if it is this file






Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=327033386&siteId=291194637