Sequential read performance tuning

The VMM sequential read-ahead feature can enhance the performance of programs that access large files sequentially.

The VMM sequential read-ahead feature is described in Sequential page read ahead .

The following illustrates a typical read-ahead situation.

Figure 1. Sequential Read-Ahead Example. This illustration shows a row of blocks simulating a segmented track of file page numbers. These block segments are numbered 0, 1 through 3, 4 through 7, 8 through 15 and 16 through 23. The steps of a sequential read-ahead are found in the text immediately following the illustration.
Sequential Read-Ahead Example

In this example, minpgahead is 2 and maxpgahead is 8 (the defaults). The program is processing the file sequentially. Only the data references that have significance to the read-ahead mechanism are shown, designated by A through F. The sequence of steps is:

A
The first access to the file causes the first page (page 0) of the file to be read. At this point, the VMM makes no assumptions about random or sequential access.
B
When the program accesses the first byte of the next page (page 1), with no intervening accesses to other pages of the file, the VMM concludes that the program is accessing sequentially. It schedules minpgahead (2) additional pages (pages 2 and 3) to be read. Thus access B causes a total of 3 pages to be read.
C
When the program accesses the first byte of the first page that has been read ahead (page 2), the VMM doubles the page-ahead value to 4 and schedules pages 4 through 7 to be read.
D
When the program accesses the first byte of the first page that has been read ahead (page 4), the VMM doubles the page-ahead value to 8 and schedules pages 8 through 15 to be read.
E
When the program accesses the first byte of the first page that has been read ahead (page 8), the VMM determines that the page-ahead value is equal to maxpgahead and schedules pages 16 through 23 to be read.
F
The VMM continues reading maxpgahead pages when the program accesses the first byte of the previous group of read-ahead pages until the file ends.

If the program were to deviate from the sequential-access pattern and access a page of the file out of order, sequential read-ahead would be terminated. It would be resumed with minpgahead pages if the VMM detected that the program resumed sequential access.

The minpgahead and maxpgahead values can be changed by using options -r and -R in the ioo command. If you are contemplating changing these values, keep in mind:

  • The values should be from the set: 0, 1, 2, 4, 8, 16, and so on. The use of other values may have adverse performance or functional effects.
    • Values should be powers of 2 because of the doubling algorithm of the VMM.
    • Values of maxpgahead greater than 16 (reads ahead of more than 64 KB) exceed the capabilities of some disk device drivers. In such a case, the read size stays at 64 KB.
    • Higher values of maxpgahead can be used in systems where the sequential performance of striped logical volumes is of paramount importance.
  • A value of 0 for both minpgahead and maxpgahead effectively defeats the mechanism. This can adversely affect performance. However, it can be useful in some cases where I/O is random, but the size of the I/Os cause the VMM's read-ahead algorithm to take effect.
  • The maxpgahead values of 8 or 16 yield the maximum possible sequential I/O performance for non-striped file systems.
  • The buildup of the read-ahead value from minpgahead to maxpgahead is quick enough that for most file sizes there is no advantage to increasing minpgahead.
  • Sequential Read-Ahead can be tuned separately for JFS and Enhanced JFS. JFS Page Read-Ahead can be tuned with minpgahead and maxpgahead whereas j2_minPageReadAhead and j2_maxPageReadAhead are used for Enhanced JFS.