JFS Tuning and Performance

14
Figure 8. Example of unaligned direct I/O
Using a smaller block size, such as 1 KB, will improve chances of doing more optimal direct I/O.
However, even with a 1 KB file system block size, unaligned I/Os can occur.
Also, when doing direct I/O writes, a file‟s buffers must be searched to locate any buffers that
overlap with the direct I/O request. If any overlapping buffers are found, those buffers are
invalidated. Invalidating overlapping buffers is required to maintain consistency of the data in the
cache and on disk. A direct I/O write would put newer data on the disk and thus the data in the
cache would be stale unless it is invalidated. If the number of buffers for a file is large, then the
process may spend a lot of time searching the files list of buffers before each direct I/O is performed.
The invalidating of buffers when doing direct I/O writes can degrade performance so severely, that
mixing buffered and direct I/O in the same file is highly discouraged.
Mixing buffered I/O and direct I/O can occur due to discovered direct I/O, unaligned direct I/O, or
if there is a mix of synchronous and asynchronous operations and the mincache and convosync
options are not set to the same value.
Note
Mixing buffered and direct I/O on the same file can cause severe
performance degradation on HP-UX 11i v2 or earlier systems.
Direct I/O on HP-UX 11.31 with VxFS 4.1
HP-UX 11.31 introduced the Unified File Cache (UFC). The UFC is similar to the HP-UX buffer cache in
function, but is 4 KB page based as opposed to 8 KB buffer based. The alignment issues are similar
with HP-UX 11.23 and earlier, although it may only be necessary to read in a single 4 KB page, as
opposed to an 8 KB buffer.
Also, the mixing of cached I/O and buffered I/O is no longer a performance issue, as the UFC
implements a more efficient algorithm for locating pages in the UFC that overlap with the direct I/O
request.
Direct I/O on HP-UX 11.31 with VxFS 5.0 and later
VxFS 5.0 on HP-UX 11i v3 introduced an enhancement that no longer requires direct I/O to be
aligned on a file system block boundary. Instead, the direct I/O only needs to be aligned on a device
block boundary, which is a 1 KB boundary. File systems with a 1 KB file system block size are not
impacted, but it is no longer necessary to recreate file systems with a 1 KB file system block size if the
application is doing direct I/O requests aligned on a 1 KB boundary.
4K
4K
8K
4K
4K
16k random write using Direct I/O
8K
Buffered
I/O
Buffered
I/O
Direct I/O
8K
8k
8 KB fs
block
8 KB fs
block
8 KB fs
block