title: Readahead effect on Linux fread()
body: <p>I have a problem with readahead performance of a large binary file. </p>
  
  <p>My strategy is</p>
  
  <ul>
  <li>Read a fixed size chunk from the large binary file with
  fread(). (e.g. 10MB)</li>
  <li><p>Sleep for n milliseconds with usleep() just for readahead performance measuring.</p></li>
  <li><p>Repeat it until the entire file is read.</p></li>
  </ul>
  
  <p>Then, I did an experiment of the above strategy for measuring readahead performance. The environment is </p>
  
  <ul>
  <li>CentOS 7</li>
  <li>4GB binary file</li>
  <li>Chunk sizes are 2 ~ 300MB per 2MB</li>
  <li>Sleeping times I tested are 5, 10, 50, 100, 300 ms and no sleep</li>
  </ul>
  
  <p>The results:
  <a href="https://i.stack.imgur.com/bmJJR.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/bmJJR.png" alt="enter image description here"></a></p>
  
  <p>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.</p>
  
  <p>Then, I want to do regression analysis to this graph. What function should I use? What is the complexity of my strategy?</p>