原文地址:http://linuxmantra.com/2013/11/disk-read-ahead-in-linux.html
We know that Input Output process on disk is always a time consuming process. A number of ideas has been applied to improve I/O performance on disk and Read-Ahead is of the those ideas.
Read-Ahead speeds up file access (Read operation on disk) by pre-fetching data and loading it into RAM. The assumption is that in sequential access pre-fetching will reduce time to perform complete operation. The advantage of Read-Ahead is that the next data available if RAM before transfer request raised for same. Remember that Read-Ahead could only be useful for sequential access, for random access this feature will not be used. Linux kernel are smart enough to detect that if the request is sequential or random.
How many sectors will be Read-Ahead for sequential access ?
On RHEL 6.x and CentOS 6.x, you can issue following command to get that setting
#blockdev — getra /dev/sda
(here getra is get Read-Ahead, /dev/sda is the disk )
By default Read-Ahead value will be 256 sector.
If you want value in KB then look into /sys/block/
#cat /sys/block/sda/queue/read_ahead_kb
Here the output should be 128, as we know (2 Sector=2×1024=1KB)
If you want to update Read-Ahead value with new one, use –setra option with blockdev command
#blockdev — setra 512 /dev/sda