Product SiteDocumentation Site

5. Tuning a Scheduler and Device Request Queue Parameters

Once you have selected a scheduler, you can also further tune its behavior through several request queue parameters. Every I/O scheduler has its set of tunable options. These options are located (and tuned) in /sys/block/<device>/queue/iosched/.
In addition to these, each device also has tunable request queue parameters located in /sys/block/<device>/queue/.
Scheduler options and device request queue parameters are set in the same fashion. To set these tuning options, echo the specified value to the specified tuning option, i.e.:
echo <value> > /sys/block/<device>/queue/iosched/<option>
For example: the system is currently using the anticipatory scheduler for device hda. To change /sys/block/hda/queue/iosched/read_expire to 80 milliseconds, use:
echo 80 > /sys/block/hda/queue/iosched/read_expire
However, as mentioned in Section 4, “Selecting a Scheduler”, any configuration set though echo commands to the /sys/ file system is not persistent thoughout system reboots. As such, to make any scheduler selection/request queue settings persistent throughout system reboots, use /etc/rc.d/rc.local.

5.1. Request Queue Parameters

Block devices have the following tunable parameters:
nr_requests
This file sets the depth of the request queue. nr_requests sets the maximum number of disk I/O requests that can be queued up. The default value for this is dependent on the selected scheduler.
If nr_requests is set higher, then generally the I/O subsystem will have a larger threshold at which it will keep scheduling requests by order of increasing disk block number. This keeps the I/O subsystem moving in one direction longer, which in most cases is the most efficient way of handling disk I/O.
read_ahead_kb
This file sets the size of read-aheads, in kilobytes. As discussed in
Section 2, “The I/O Subsystem”, the I/O subsystem will enable read-aheads once it detects a sequential disk block access. This file sets the amount of data to be “pre-fetched” for an application and cached in memory to improve read response time.