hoytech / vmtouch

Portable file system cache diagnostics and control
https://hoytech.com/vmtouch/
BSD 3-Clause "New" or "Revised" License
1.79k stars 210 forks source link

Is it possible to evict partial of cached file ? #79

Open aero opened 4 years ago

aero commented 4 years ago

Hello,

cachectl( https://github.com/cubicdaiya/cachectl ) supports -r option.

If you want to leave a cache appended recently, assigning a rate for purging page cache with -r is recommended.

cachectl -op purge -f /var/log/access_log -r 0.9

Can I get the same fuctionality with vmtouch ?

hoytech commented 4 years ago

Not exactly the same, but you can choose a range of the file to evict with -p. For example, suppose you had a 100M file, you could run:

vmtouch -e -p 0-90M /var/log/access_log

To evict the first 90M of the file and leave the remaining unevicted.

How does cachectl decide which part of the file to evict?