Clear file system cache before doing I/O-intensive benchmark on Linux

submited by
Style Pass
2021-07-15 03:00:05

If you do any I/O-intensive benchmark, please run following command before it (Otherwise you may get wrong impression of the program performance):

sync means writing data from cache to file system (otherwise the dirty cache can’t be freed); “echo 3 > /proc/sys/vm/drop_caches” will drop clean caches, as well as reclaimable slab objects. Check following command:

the first run time of benchmark program is ~12 seconds. Now that the files are cached, the second run time of benchmark program is halved: ~6 seconds.

Leave a Comment