Operations 6 min read

Choosing the Right Linux I/O Scheduler: Algorithms, Commands, and Performance Benchmarks

This article explains Linux I/O scheduler concepts, compares the main algorithms (noop, cfq, deadline), shows how to view and modify scheduler settings on CentOS 6/7, and presents performance test results indicating the optimal scheduler choices for SSD and SAS disks.

Raymond Ops
Raymond Ops
Raymond Ops
Choosing the Right Linux I/O Scheduler: Algorithms, Commands, and Performance Benchmarks

Linux I/O scheduler is a component of the Linux kernel that sits between the generic block layer and block device drivers, allowing system performance optimization by selecting different scheduling algorithms.

1. Scheduling Algorithms

The main I/O schedulers in Linux are:

noop : a simple FIFO “elevator” algorithm, suitable for SSDs due to fast random I/O.

cfq (Completely Fair Scheduler): creates a separate queue for each process/thread to distribute I/O bandwidth evenly; default in CentOS 6.

deadline : assigns a deadline to each I/O request; performs best on mechanical disks and database workloads; default in CentOS 7.

2. Viewing and Changing the Scheduler

On CentOS 7 the available schedulers are listed with:

<code>[[email protected] www]# dmesg | grep -i scheduler
[    1.307640] io scheduler noop registered
[    1.308944] io scheduler deadline registered (default)
[    1.310445] io scheduler cfq registered
[    1.311733] io scheduler mq-deadline registered
[    1.313133] io scheduler kyber registered
</code>

On CentOS 6 the list includes:

<code>[[email protected] www]# dmesg | grep -i scheduler
io scheduler noop registered
io scheduler anticipatory registered
io scheduler deadline registered
io scheduler cfq registered (default)
</code>

To check the current scheduler for a device:

<code># cat /sys/block/sda/queue/scheduler
noop [deadline] cfq
</code>

Temporary changes:

<code># echo 'noop' > /sys/block/sda/queue/scheduler
# cat /sys/block/sda/queue/scheduler
[noop] deadline cfq
</code>
<code># echo 'cfq' > /sys/block/sda/queue/scheduler
# cat /sys/block/sda/queue/scheduler
noop deadline [cfq]
</code>

Permanent changes for CentOS 7:

<code># grubby --update-kernel=ALL --args="elevator=deadline"
# reboot
</code>

Permanent changes for CentOS 6 (edit

/boot/grub/menu.lst

or

/boot/grub/grub.conf

and add

elevator=deadline

to the kernel line).

3. Performance Comparison

Benchmark results using sysbench on MySQL with an SSD show that the noop scheduler yields the highest IOPS and throughput, followed by deadline and cfq . For SAS disks, deadline performs best.

Algorithm   Write IOPS   Write Speed   Read IOPS   Read Speed   oltp_write_only (TPS)   oltp_read_only (TPS)
deadline    6935.37      118.37MiB/s   7956.88    124.33MiB/s  491.43 / 2948.62        393.13 / 6290.13
noop        7057.60      110.27MiB/s   8399.89    131.25MiB/s  544.38 / 3266.28        379.97 / 6079.59
cfq         6614.37      103.35MiB/s   7481.39    116.90MiB/s  498.54 / 2991.25        344.66 / 5514.58

In summary, SSDs benefit from the noop or deadline scheduler, while SAS disks perform best with deadline . CentOS 7 defaults to deadline , so manual tuning is usually unnecessary on newer releases, but it remains relevant for CentOS 6.

PerformanceLinuxSSDCentOSio-scheduler
Raymond Ops
Written by

Raymond Ops

Linux ops automation, cloud-native, Kubernetes, SRE, DevOps, Python, Golang and related tech discussions.

0 followers
Reader feedback

How this landed with the community

login Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.