A read-ahead request is an I/O request to prefetch multiple pages in the buffer pool asynchronously, in anticipation that these pages will be needed soon. InnoDB uses or has used two read-ahead algorithms to improve I/O performance:
Linear read-ahead is based on
the access pattern of the pages in the buffer pool, not just their
number. You can control when InnoDB performs a read-ahead
operation by adjusting the number of sequential page accesses
required to trigger an asynchronous read request, using the
configuration parameter
innodb_read_ahead_threshold.
Before this parameter was added, InnoDB would only calculate
whether to issue an asynchronous prefetch request for the entire
next extent when it read in the last page of the current extent.
Random read-ahead is a former technique that has now been removed as of MySQL 5.5. If a certain number of pages from the same extent (64 consecutive pages) were found in the buffer pool, InnoDB asynchronously issued a request to prefetch the remaining pages of the extent. Random read-ahead added unnecessary complexity to the InnoDB code and often resulted in performance degradation rather than improvement. This feature is no longer part of InnoDB, and users should generally see equivalent or improved performance.
If the number of pages read from an extent of 64 pages is greater
or equal to
innodb_read_ahead_threshold,
InnoDB initiates an asynchronous read-ahead operation of the
entire following extent. Thus, this parameter controls how
sensitive InnoDB is to the pattern of page accesses within an
extent in deciding whether to read the following extent
asynchronously. The higher the value, the more strict the access
pattern check. For example, if you set the value to 48, InnoDB
triggers a linear read-ahead request only when 48 pages in the
current extent have been accessed sequentially. If the value is 8,
InnoDB would trigger an asynchronous read-ahead even if as few as
8 pages in the extent were accessed sequentially.
The new configuration parameter
innodb_read_ahead_threshold
can be set to any value from 0-64. The default value is 56,
meaning that an asynchronous read-ahead is performed only when 56
of the 64 pages in the extent are accessed sequentially. You can
set the value of this parameter in the MySQL option file (my.cnf
or my.ini), or change it dynamically with the SET
GLOBAL command, which requires the
SUPER privilege.
The SHOW ENGINE INNODB STATUS command displays
statistics to help you evaluate the effectiveness of the
read-ahead algorithm. See
Section 14.4.8.8, “More Read-Ahead Statistics” for more
information.
For more information about I/O performance, see
Section 8.5.7, “Optimizing InnoDB Disk I/O” and
Section 8.11.3, “Optimizing Disk I/O”.

User Comments
Add your own comment.