cache-bench is a Python script that evaluates the impact of virtual memory settings (vm.swappiness, vm.watermark_scale_factor, Multigenerational LRU Framework, and others) on the performance of tasks dependent on caching file read operations in low memory conditions. The code is open under the CC0 license.
The primary usage method involves reading files from a specified directory in random order and adding them to a list until a specified number of mebibytes is read. Two operating modes are available:
- The first mode, auxiliary, is used to create a directory of a specified size. It creates a certain number of mebibyte files with random names in the directory.
- The second mode, main, is for reading files from the specified directory in random order. During reading, the memory consumed by the script increases, and the speed of reading the specified volume of files depends on the amount of cached file pages.
An auxiliary script, drop-cache, is also part of the project, which is recommended to run before starting the test. During the reading mode, the script outputs the total runtime, average read speed, and the name of the last read file. The script also allows logging results to a file with timestamps.
Source: opennet.ru
