24.05.2014 Views

AIX Version 4.3 Differences Guide

AIX Version 4.3 Differences Guide

AIX Version 4.3 Differences Guide

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

applications that call load or loadbind many times since breakpoints and other<br />

changes will not have to be reinserted.<br />

4.6 Direct I/O<br />

Direct I/O is a way of opening JFS files that allows for disk reads and writes using<br />

less CPU cycles than normal I/O. The main CPU savings come from avoiding the<br />

memory-to-memory copy done by the JFS. As the difference between memory<br />

and CPU cycle times increases, the savings achieved by avoiding this copy<br />

becomes greater.<br />

Direct I/O offers a big performance gain for applications that do large block I/O<br />

(32 KB or greater) to JFS files and a smaller increase in performance for small<br />

block I/O. It does not improve raw I/O performance.<br />

With normal I/O, the I/O request is first sent to the device driver. To service the<br />

request the device driver uses Direct Memory Access (DMA) to copy the data to<br />

or from pages in a file persistent segment. The data is then copied between the<br />

persistent segment and userspace through calls to vmcopyin() or vmcopyout().<br />

Thus, a files persistent segment acts as a file cache.<br />

With direct I/O, the data is not cached, but rather, I/O is done directly to a user<br />

supplied buffer through cross-memory technology. In other words, DMA is done<br />

directly from the disk to user space and conversely through the device strategy<br />

routine of the JFS file system.<br />

Optimization was also made to the DMA setup routines. This improves large<br />

block I/O to JFS files and to raw logical volumes. However, the benefits of the<br />

DMA changes are much less than the benefits of direct I/O.<br />

Take Note<br />

It is important to note that since direct I/O reads are done synchronously and<br />

there is no read-ahead benefit, if they are not used correctly, they can also take<br />

much longer. The only read-ahead-like semantics that direct I/O can benefit<br />

from will be read-ahead performed by the disk device driver (normally 32 KB).<br />

For this reason, it is very important for a direct I/O reader to specify large read<br />

requests to match the performance of normal cached I/O readers. To match the<br />

performance of normal cached I/O readers, a direct I/O reader should issue<br />

read requests of at least 128 KB.<br />

Direct I/O is considered advisory. This means that if a file is opened for direct I/O,<br />

and another application decides to open that same file for normal I/O, the file will<br />

be opened using normal cached I/O until direct I/O can be resumed (the normal<br />

I/O application closes the file).<br />

Files can also be opened for a deferred update using the O_DEFER flag. If a file<br />

is opened with O_DEFER, and a subsequent open for direct I/O is issued, all<br />

writes will use normal cached I/O. Similarly, if another application opens the file<br />

with O_DEFER while it is already opened for direct I/O, all I/O to the file will be<br />

cached.<br />

Application Development and Pthreads 77

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!