Disk Read-Ahead in Linux

By | November 8, 2013

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

Share itShare on FacebookEmail this to someoneTweet about this on TwitterShare on Google+Share on LinkedInPrint this page

One thought on “Disk Read-Ahead in Linux

  1. Linux Command List

    Right here is the right website for everyone who hopes to find out about this topic. You realize a whole lot its almost hard to argue with you (not that I really will need to…HaHa). You certainly put a new spin on a topic which has been discussed for many years. Great stuff, just great!


Leave a Reply

Your email address will not be published. Required fields are marked *

Current month ye@r day *