JFS Tuning and Performance

13
Note
The OnlineJFS license is required to perform direct I/O when using VxFS
5.0 or earlier. Beginning with VxFS 5.0.1, direct I/O is available with the
Base JFS product.
Discovered direct I/O
With HP OnLineJFS, direct I/O will be enabled if the read or write size is greater than or equal to the
file system tunable discovered_direct_iosz. The default discovered_direct_iosz is 256 KB. As with
direct I/O, all discovered direct I/O will be synchronous. Read ahead and flush behind will not be
performed with discovered direct I/O.
If read ahead and flush behind is desired for large reads and writes or the data needs to be reused
from buffer/file cache, then the discovered_direct_iosz can be increased as needed.
Direct I/O and unaligned data
When performing Direct I/O, alignment is very important. Direct I/O requests that are not properly
aligned have the unaligned portions of the request managed through the buffer or file cache.
For writes, the unaligned portions must be read from disk into the cache first, and then the data in the
cache is modified and written out to disk. This read-before-write behavior can dramatically increase
the times for the write requests.
Note
The best direct I/O performance occurs when the logical requests are
properly aligned. Prior to VxFS 5.0 on 11i v3, the logical requests need to
be aligned on file system block boundaries. Beginning with VxFS 5.0 on
11i v3, logical requests need to be aligned on a device block boundary (1
KB).
Direct I/O on HP-UX 11.23
Unaligned data is still buffered using 8 KB buffers (default size), although the I/O is still done
synchronously. For all VxFS versions on HP-UX 11i v2 and earlier, direct I/O performs well when the
request is aligned on a file system block boundary and the entire request can by-pass the buffer
cache. However, requests smaller than the file system block size or requests that do not align on a file
system block boundary will use the buffer cache for the unaligned portions of the request.
For large transfers greater than the block size, part of the data can still be transferred using direct
I/O. For example, consider a 16 KB write request on a file system using an 8 KB block where the
request does not start on a file system block boundary (the data starts on a 4 KB boundary in this
case). Since the first 4 KB is unaligned, the data must be buffered. Thus an 8 KB buffer is allocated,
and the entire 8 KB of data is read in, thus 4 KB of unnecessary data is read in. This behavior is
repeated for the last 4 KB of data, since it is also not properly aligned. The two 8 KB buffers are
modified and written to the disk along with the 8 KB direct I/O for the aligned portion of the request.
In all, the operation took 5 synchronous physical I/Os, 2 reads and 3 writes. If the file system is re-
created to use a 4 KB block size or smaller, the I/O would be aligned and could be performed in a
single 16 KB physical I/O.