Direct I/O is a feature of the file system whereby file reads and writes go directly from the applications to the storage device, bypassing the operating system read and write caches. Direct I/O is used only by applications (such as databases) that manage their own caches.
An application invokes direct I/O by opening a file with the O_DIRECT
flag.
Under certain circumstances, Direct I/O can improve application performance, from bypassing the file system cache. If the application is a database application, for example, it may already have its own cache in the database. Using direct IO will be beneficial in this case. However, if the application takes advantage of the file system cache by reusing data, direct IO could actually result in decreased application performance.
In the event that file system I/O exceeds the physical memory size of the system, the VM will start re-claiming pages, which can result in a notable performance decrease. In this case, direct I/O can be very beneficial.