blob: 6cebc7b6ee2253e9a7bf1f7083830781b666f37e [file] [log] [blame]
unixtest57abe5b2016-01-31 10:47:03 +00001# ./cachestat -h
2USAGE: ./cachestat [-T] [ interval [count] ]
3
4show Linux page cache hit/miss statistics including read and write hit %
5
6optional arguments:
7 -T include timestamp on output
8
9examples:
10 ./cachestat # run with default option of 5 seconds delay
11 ./cachestat -T # run with default option of 5 seconds delay with timestamps
12 ./cachestat 1 # print every second hit/miss stats
13 ./cachestat -T 1 # include timestamps with one second samples
14 ./cachestat 1 5 # run with interval of one second for five iterations
15 ./cachestat -T 1 5 # include timestamps with interval of one second for five iterations
16
17
18# ./cachestat 1
19 HITS MISSES DIRTIES READ_HIT% WRITE_HIT% BUFFERS_MB CACHED_MB
20 0 58 0 0.0% 100.0% 0 11334
21 146113 0 0 100.0% 0.0% 0 11334
22 244143 0 0 100.0% 0.0% 0 11334
23 216833 0 0 100.0% 0.0% 0 11334
24 248209 0 0 100.0% 0.0% 0 11334
25 205825 0 0 100.0% 0.0% 0 11334
26 286654 0 0 100.0% 0.0% 0 11334
27 275850 0 0 100.0% 0.0% 0 11334
28 272883 0 0 100.0% 0.0% 0 11334
29 261633 0 0 100.0% 0.0% 0 11334
30 252826 0 0 100.0% 0.0% 0 11334
31 235253 70 3 100.0% 0.0% 0 11335
32 204946 0 0 100.0% 0.0% 0 11335
33 0 0 0 0.0% 0.0% 0 11335
34 0 0 0 0.0% 0.0% 0 11335
35 0 0 0 0.0% 0.0% 0 11335
36
37Above shows the reading of a 12GB file already cached in the OS page cache and again below with timestamps.
38
39# ./cachestat -T 1
40TIME HITS MISSES DIRTIES READ_HIT% WRITE_HIT% BUFFERS_MB CACHED_MB
4116:07:10 0 0 0 0.0% 0.0% 0 11336
4216:07:11 0 0 0 0.0% 0.0% 0 11336
4316:07:12 117849 0 0 100.0% 0.0% 0 11336
4416:07:13 212558 0 0 100.0% 0.0% 0 11336
4516:07:14 302559 1 0 100.0% 0.0% 0 11336
4616:07:15 309230 0 0 100.0% 0.0% 0 11336
4716:07:16 305701 0 0 100.0% 0.0% 0 11336
4816:07:17 312754 0 0 100.0% 0.0% 0 11336
4916:07:18 308406 0 0 100.0% 0.0% 0 11336
5016:07:19 298185 0 0 100.0% 0.0% 0 11336
5116:07:20 236128 0 0 100.0% 0.0% 0 11336
5216:07:21 257616 0 0 100.0% 0.0% 0 11336
5316:07:22 179792 0 0 100.0% 0.0% 0 11336
54
55Command used to generate the activity
56# dd if=/root/mnt2/testfile of=/dev/null bs=8192
571442795+0 records in
581442795+0 records out
5911819376640 bytes (12 GB) copied, 3.9301 s, 3.0 GB/s
60
61Below shows the dirty ratio increasing as we add a file to the page cache
62# ./cachestat.py
63 HITS MISSES DIRTIES READ_HIT% WRITE_HIT% BUFFERS_MB CACHED_MB
64 1074 44 13 94.9% 2.9% 1 223
65 2195 170 8 92.5% 6.8% 1 143
66 182 53 56 53.6% 1.3% 1 143
67 62480 40960 20480 40.6% 19.8% 1 223
68 7 2 5 22.2% 22.2% 1 223
69 348 0 0 100.0% 0.0% 1 223
70 0 0 0 0.0% 0.0% 1 223
71 0 0 0 0.0% 0.0% 1 223
72 0 0 0 0.0% 0.0% 1 223
73 0 0 0 0.0% 0.0% 1 223
74
75The file copied into page cache was named 80m with a size of 83886080 (83886080/4096) = 20480, this matches what we see under dirties