Git Product home page Git Product logo

liliyishsf / cachemaster Goto Github PK

View Code? Open in Web Editor NEW

This project forked from caisonglu/cachemaster

0.0 1.0 0.0 122 KB

Cachemaster is similar to VMTOUCH, but with more functions. Such as kick page cache, warmup/readahead data, lock data in mem, stat page cache, stat page cache in realtime mode, by file or directory~ Personally, I think the most usefule function is real-time-statistic of page cache. You can see the page cache thrashing when kernel do page reclaiming.

C 100.00%

cachemaster's Introduction

cachemaster

##Introduction Cachemaster is similar to VMTOUCH, but with more functions.
Such as:
Kick page cache,
Warmup/readahead data,
Lock data in mem,
Stat page cache,
Stat page cache in realtime mode,
By file or directory~

##Contributors [email protected],[email protected]

##Examples

###Stat page cache of file

-bash-3.2$ ./cachemaster -s -f data
Stat:data size:488M cached:488M

###Stat page cache of directory

-bash-3.2$ ./cachemaster -s -d mydir/
Stat:mydir//file1 size:488M cached:0Bytes
Stat:mydir//file2 size:488M cached:488M
Stat:mydir//child/file3 size:488M cached:488M
Total Cache of Directory:mydir/ size:1.4G cached:976M

###Kick page cache of file

-bash-3.2$ ./cachemaster -s -f data
Stat:data size:488M cached:488M
-bash-3.2$ ./cachemaster -c -f data
Release:data
-bash-3.2$ ./cachemaster -s -f data
Stat:data size:488M cached:0Bytes

###Kick page cache of directory

-bash-3.2$ ./cachemaster -s -d mydir/
Stat:mydir//file1 size:488M cached:0Bytes
Stat:mydir//file2 size:488M cached:488M
Stat:mydir//child/file3 size:488M cached:488M
Total Cache of Directory:mydir/ size:1.4G cached:976M
-bash-3.2$ ./cachemaster -c -d mydir/
Release:mydir//file1
Release:mydir//file2
Release:mydir//child/file3
-bash-3.2$ ./cachemaster -s -d mydir/
Stat:mydir//file1 size:488M cached:0Bytes
Stat:mydir//file2 size:488M cached:0Bytes
Stat:mydir//child/file3 size:488M cached:0Bytes
Total Cache of Directory:mydir/ size:1.4G cached:0Bytes

###Lock in mem of file

-bash-3.2$ ./cachemaster -l -f data
Lock data succeed, size:488M

###Lock in mem of file in daemon

-bash-3.2$ ./cachemaster -l -f data -m
-bash-3.2$ ps xf | grep cachemaster | grep -v grep
28279 ? SLs 0:00 ./cachemaster -l -f data -m

###Lock in mem of directory

-bash-3.2$ ./cachemaster -l -d mydir/
Lock mydir//file1 succeed, size:488M
Lock mydir//file2 succeed, size:488M
Lock mydir//child/file3 succeed, size:488M

###Lock in mem of directory in daemon

-bash-3.2$ ./cachemaster -l -d mydir/ -m
-bash-3.2$ ps xf | grep cachemaster | grep -v grep
28694 ? SLs 0:00 ./cachemaster -l -d mydir/ -m

###Real time stat of file(-i is interval, default 1s)

-bash-3.2$ ./cachemaster -r -f data
file:data
time pageCount inCache change
[2103-8-5 16:03:14] 125000 125000 125000
[2103-8-5 16:03:15] 125000 125000 0
[2103-8-5 16:03:16] 125000 125000 0
[2103-8-5 16:03:17] 125000 125000 0

###Real time stat of directory(-i is interval, default 1s)

-bash-3.2$ ./cachemaster -r -d mydir/ -i 0.5
file:mydir/
time pageCount inCache change
[2103-8-5 16:05:12] 375000 375000 375000
[2103-8-5 16:05:13] 375000 375000 0
[2103-8-5 16:05:13] 375000 375000 0
[2103-8-5 16:05:14] 375000 375000 0
[2103-8-5 16:05:15] 375000 375000 0

###Real time stat of directory(-s suppress the unchanged line)

-bash-3.2$ ./cachemaster -r -d mydir/ -i 0.5 -S
file:mydir/
time pageCount inCache change
[2103-8-5 16:10:52] 375000 375000 375000
[2103-8-5 16:11:17] 375000 358841 -16159
[2103-8-5 16:11:17] 375000 0 -358841

###Warmup/Readahead of file

-bash-3.2$ ./cachemaster -c -f data
Release:data
-bash-3.2$ ./cachemaster -s -f data
Stat:data size:488M cached:0Bytes
-bash-3.2$ ./cachemaster -w -f data
Warmup File:data TimeUsed:6027 ms
-bash-3.2$ ./cachemaster -s -f data
Stat:data size:488M cached:488M

###Warmup/Readahead of directory

-bash-3.2$ ./cachemaster -s -d mydir/
Stat:mydir//file1 size:488M cached:0Bytes
Stat:mydir//file2 size:488M cached:0Bytes
Stat:mydir//child/file3 size:488M cached:0Bytes
Total Cache of Directory:mydir/ size:1.4G cached:0Bytes
-bash-3.2$ ./cachemaster -w -d mydir/
Warmup File:mydir//file1 TimeUsed:5668 ms
Warmup File:mydir//file2 TimeUsed:5787 ms
Warmup File:mydir//child/file3 TimeUsed:6061 ms
Warmup Dir:mydir//child TimeUsed:6061 ms
Warmup Dir:mydir/ TimeUsed:17517 ms
-bash-3.2$ ./cachemaster -s -d mydir/
Stat:mydir//file1 size:488M cached:488M
Stat:mydir//file2 size:488M cached:488M
Stat:mydir//child/file3 size:488M cached:488M
Total Cache of Directory:mydir/ size:1.4G cached:1.4G

##Help

Usage:./cachemaster [Option] [File] ...
-c Clear Page Cache.
-l Lock file into memory.
-r Real Time Stat of Page Cache.
-s Stat of Page Cache.
-w Read ahead to page cache, for warmup.
-f Operation on a file.
-d Operation on a directory.
-m Lock in daemon, only used with -l.
-i Interval when in real time stat.
-c -s -r -l -w is mutual with each other; -f is mutual with -d
-S Suppress the unchanged line, only used with -r.
Example:
./cachemaster -c -f file_name | Clear cache of a file
./cachemaster -c -d dir_name | Clear cache of a direcroty
./cachemaster -s -f file_name | Stat cache of a file
./cachemaster -s -d dir_name | Stat cache of a direcroty
./cachemaster -r -f file_name | Stat real time cache of a file
./cachemaster -r -d dir_name | Stat real time cache of a direcroty
./cachemaster -l -f file_name | Lock file
./cachemaster -l -d dir_name | Lock direcroty
./cachemaster -w -f file_name | Warmup file
./cachemaster -w -d dir_name | Warmup direcroty
./cachemaster -l -f -m file_name | Lock file in daemon
./cachemaster -l -d -m dir_name | Lock direcroty in daemon

cachemaster's People

Contributors

caisonglu avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.