Skip to content
This repository has been archived by the owner on Apr 22, 2024. It is now read-only.
/ rarara Public archive

Prime buffer cache for a file via readahead from the command line (linux only).

Notifications You must be signed in to change notification settings

miku/rarara

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

27 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

rarara

Prime buffer cache for a file via readahead from the command line (linux only).

readahead() initiates readahead on a file so that subsequent reads from that file will be satisfied from the cache, and not block on disk I/O (assuming the readahead was initiated early enough and that other activity on the system did not in the meantime flush pages from the cache).

Usage

$ rarara FILENAME [OFFSET [COUNT]]

Try to cache the whole file starting at the beginning by default.

Alternatives

dd, which is POSIX. Example 2.5G file:

$ time rarara big.file 0 2459650481
real    0m13.803s

$ time dd if=big.file of=/dev/null bs=4096 count=600501 skip=0
real    0m14.394s

7.4 GB file:

$ time dd if=bigger.file of=/dev/null bs=64k
113123+1 records in
113123+1 records out
7413691873 bytes (7.4 GB) copied, 43.7198 s, 170 MB/s

real    0m43.778s
user    0m0.028s
sys     0m3.672s

$ time rarara bigger.file
readahead [0:7413691873]

real    0m23.753s
user    0m0.004s
sys     0m0.464s

See also

About

Prime buffer cache for a file via readahead from the command line (linux only).

Resources

Stars

Watchers

Forks

Packages