I have a problem with readahead performance of a large binary file.
My strategy is
- Read a fixed size chunk from the large binary file with fread(). (e.g. 10MB)
Sleep for n milliseconds with usleep() just for readahead performance measuring.
Repeat it until the entire file is read.
Then, I did an experiment of the above strategy for measuring readahead performance. The environment is
- CentOS 7
- 4GB binary file
- Chunk sizes are 2 ~ 300MB per 2MB
- Sleeping times I tested are 5, 10, 50, 100, 300 ms and no sleep
As you can see in the result, when the chunk size is small and sleeping time is long enough for readahead, the reading time is short. The bigger chunk size is or the shorter sleeping time is , the closer to about 20 seconds reading time gets.
Then, I want to do regression analysis to this graph. What function should I use? What is the complexity of my strategy?