JFS Tuning and Performance

6
Data access methods
Buffered/cached I/O
By default, most access to files in a VxFS file system is through the cache. In HP-UX 11i v2 and
earlier, the HP-UX Buffer Cache provided the cache resources for file access. In HP-UX 11i v3 and
later, the Unified File Cache is used. Cached I/O allows for many features, including asynchronous
prefetching known as
read ahead
, and asynchronous or delayed writes known as
flush behind
.
Read ahead
When reads are performed sequentially, VxFS detects the pattern and reads ahead or prefetches data
into the buffer/file cache. VxFS attempts to maintain 4 read ahead “segments” of data in the
buffer/file cache, using the read ahead size as the size of each segment.
Figure 1. VxFS read ahead
The segments act as a pipeline. When the data in the first of the 4 segments is read, asynchronous
I/O for a new segment is initiated, so that 4 segments are maintained in the read ahead pipeline.
The initial size of a read ahead segment is specified by VxFS tunable read_pref_io. As the process
continues to read a file sequentially, the read ahead size of the segment approximately doubles, to a
maximum of read_pref_io * read_nstream.
For example, consider a file system with read_pref_io set to 64 KB and read_nstream set to 4. When
sequential reads are detected, VxFS will initially read ahead 256 KB (4 * read_pref_io). As the
process continues to read ahead, the read ahead amount will grow to 1 MB (4 segments *
read_pref_io * read_nstream). As the process consumes a 256 KB read ahead segment from the front
of the pipeline, asynchronous I/O is started for the 256 KB read ahead segment at the end of the
pipeline.
By reading the data ahead, the disk latency can be reduced. The ideal configuration is the minimum
amount of read ahead that will reduce the disk latency. If the read ahead size is configured too large,
the disk I/O queue may spike when the reads are initiated, causing delays for other potentially more
critical I/Os. Also, the data read into the cache may no longer be in the cache when the data is
needed, causing the data to be re-read into the cache. These cache misses will cause the read ahead
size to be reduced automatically.
Note that if another thread is reading the file randomly or sequentially, VxFS has trouble with the
sequential pattern detection. The sequential reads may be treated as random reads and no read
ahead is performed. This problem can be resolved with enhanced read ahead discussed later. The
read ahead policy can be set on a per file system basis by setting the read_ahead tunable using
vxtunefs(1M). The default read_ahead value is 1 (normal read ahead).
256K
256K
256K
256K
Sequential read