Wednesday, October 7, 2009

IO Scheduler and QUEUE on Linux

This is a good tweak to improve performance on Linux Servers.

First you should know the different types of IO schedulers:

CFQ [cfq] (Completely Fair Queuing) is an I/O scheduler for the Linux kernel and default under many Linux distributions.

Noop scheduler (noop) is the simplest I/O scheduler for the Linux kernel based upon FIFO queue concept.

Anticipatory scheduler (anticipatory) is an algorithm for scheduling hard disk input/output as well as old scheduler which is replaced by CFQ

Deadline scheduler (deadline) - it attempt to guarantecho noop > /sys/block/hda/queue/scheduleree a start service time for a request.

By Default, Most of the Red Hat style Linux choose CFQ, However CFQ is most multitask oriented.

You can check and modify the scheduler anytime using the following command:

# cat /sys/block/sda/queue/sc
noop anticipatory deadline [cfq]

The scheduler for this machine is CFQ

# echo noop > /sys/block/hda/queue/scheduler

This change the scheduler to noop

Changing the queue size

# cat /sys/block/sda/queue/nr_requests

# echo 100000 > /sys/block/sda/queue/nr_requests

According to increasing the size of the queue
can improve dramatically the performance.


  1. Isn't 100000 too high?
    It appears that in the past there were issues with 8192:

  2. Not really... nr_requests set the maximun number of request on the queues (read and write queues). nr_requests values depends on the type of load that you have on the server. The actual 128 is considered an average value of requests, however some databases with high inserts with few reads or the other way around high reads and few writes can experience better performance with very high values since the seek time and rotational delay will be reduced.