How to Choose and Tune Linux I/O Schedulers for Maximum Performance
This article explains Linux I/O schedulers, compares the noop, cfq, and deadline algorithms, shows how to view and modify them on CentOS 6/7, and presents benchmark results indicating that the noop scheduler delivers the best performance on SSDs for MySQL workloads.
Linux I/O scheduler is a component of the Linux kernel that sits between the generic block layer and block device drivers, allowing performance optimization by selecting different scheduling algorithms.
1. Scheduling Algorithms
The main I/O schedulers in Linux are:
noop (No Operation): an elevator algorithm based on FIFO queues, suitable for SSDs because of fast random reads/writes.
cfq (Completely Fair Scheduler): creates a separate queue for each process/thread to distribute I/O evenly; default in CentOS 6.
deadline: assigns a latest execution time to each I/O request; best for mechanical disks in database workloads; also default in CentOS 7.
2. Viewing and Changing the Scheduler
In CentOS 7 the available schedulers are listed by:
[[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
[[email protected] www]#In CentOS 6 the list is:
[[email protected] www]# dmesg | grep -i scheduler
io scheduler noop registered
io scheduler anticipatory registered
io scheduler deadline registered
io scheduler cfq registered (default)CentOS 7.x uses deadline as the default scheduler, while CentOS 6.x defaults to cfq. You can also view or change the scheduler for each block device, e.g.:
# cat /sys/block/sda/queue/scheduler
noop [deadline] cfqTemporary change to noop:
# echo 'noop' >/sys/block/sda/queue/scheduler
# cat /sys/block/sda/queue/scheduler
[noop] deadline cfqTemporary change to cfq:
# echo 'cfq' >/sys/block/sda/queue/scheduler
# cat /sys/block/sda/queue/scheduler
noop deadline [cfq]To make the change permanent:
# For CentOS 7.x
grubby --update-kernel=ALL --args="elevator=deadline"
reboot
cat /sys/block/sda/queue/scheduler # shows noop [deadline] cfq
# For CentOS 6.x
Edit /boot/grub/menu.lst or /boot/grub/grub.conf and add:
kernel /boot/vmlinuz... elevator=deadline rhgb quiet3. Performance Benchmark Comparison
In summary, for SSDs the noop or deadline scheduler performs best, while SAS disks benefit from deadline. Since CentOS 7 defaults to deadline, no adjustment is usually needed, but on CentOS 6 you should consider the I/O scheduler.
A sysbench test on MySQL with an SSD shows that the noop scheduler yields the highest IOPS and throughput:
Algorithm 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 TPS (2948.62 queries) 393.13 TPS (6290.13 queries)
noop 7057.60 110.27MiB/s 8399.89 131.25MiB/s 544.38 TPS (3266.28 queries) 379.97 TPS (6079.59 queries)
cfq 6614.37 103.35MiB/s 7481.39 116.90MiB/s 498.54 TPS (2991.25 queries) 344.66 TPS (5514.58 queries)Signed-in readers can open the original source through BestHub's protected redirect.
This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactand we will review it promptly.
MaGe Linux Operations
Founded in 2009, MaGe Education is a top Chinese high‑end IT training brand. Its graduates earn 12K+ RMB salaries, and the school has trained tens of thousands of students. It offers high‑pay courses in Linux cloud operations, Python full‑stack, automation, data analysis, AI, and Go high‑concurrency architecture. Thanks to quality courses and a solid reputation, it has talent partnerships with numerous internet firms.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.
