Direct I/O read performance

Even though the use of direct I/O can reduce CPU usage, it typically results in longer elapsed times, especially for small I/O requests, because the requests would not be cached in memory.

Direct I/O reads cause synchronous reads from the disk, whereas with normal cached policy, the reads may be satisfied from the cache. This can result in poor performance if the data was likely to be in memory under the normal caching policy. Direct I/O also bypasses the VMM read-ahead algorithm because the I/Os do not go through the VMM. The read-ahead algorithm is very useful for sequential access to files because the VMM can initiate disk requests and have the pages already resident in memory before the application has requested the pages. Applications can compensate for the loss of this read-ahead by using one of the following methods:

  • Issuing larger read requests (minimum of 128 K)
  • Issuing asynchronous direct I/O read-ahead by the use of multiple threads
  • Using the asynchronous I/O facilities such as aio_read() or lio_listio()