« Previous 1 2 3
Linux I/O Schedulers
A Schedule to Keep
Changing the Scheduler
You can easily change the I/O scheduler in use. By default, that is CFQ, but if you want to change it to something like NOOP or deadline, you can, for example, change the default scheduler with the elevator=
option, either manually at the kernel
line during the boot process or in the GRUB configuration file.
To change the default I/O scheduler in GRUB, edit the /boot/grub/menu.lst
file by adding the elevator=
option. For example, you could change it from cfq
to deadline
by adding elevator=deadline
to the end of the line that begins with kernel
. Be sure to use lowercase for the name of the scheduler. After a change, run the update-grub
command.
A second way to change the I/O scheduler is on the fly. For example, you can determine which I/O scheduler is being used by looking at the /sys/block/[device]/queue/scheduler
file, where [device]
is the name of the device. For example, on my laptop, the command
# cat /sys/block/sdb/queue/scheduler noop anticipatory deadline [cfq]
shows that the current I/O scheduler (in square brackets) is cfq
. To change the scheduler, just echo
the name of the desired scheduler:
# echo deadline > /sys/block/sdb/queue/scheduler # cat /sys/block/sdb/queue/scheduler noop anticipatory [deadline] cfq
Notice how the I/O scheduler was changed to deadline . When a change of scheduler is requested, the "old" scheduler completes all of its requests before control switches over to the new scheduler.
Summary
Today's systems can have a large number of users, I/O-intensive workloads, requirements for high levels of interactivity, real-time demands, and a large number of disks and filesystems. Given the enormous strains that current systems impose on I/O subsystems, some way of controlling I/O requests is mandatory. This is where the I/O scheduler comes in.
The I/O scheduler is a very important tool for getting the best I/O performance. These schedulers can be designed to influence I/O and system behavior in whatever manner you desire. Currently, Linux includes four I/O schedulers: NOOP, anticipatory, deadline, and completely fair queuing (CFQ).
In this quick introduction to I/O schedulers, I did not discussed how to tune the various schedulers for your workload, which you can find in the documentation that comes with the source for your current kernel or online. Watching and measuring I/O performance can help you better understand your I/O workloads and how to get better performance.
The easiest way to change your I/O scheduler is to echo
the name of the new scheduler to the appropriate device file in the /sys
filesystem. The Phoronix website [9] publishes test results for various workloads.
Infos
- TOP500: https://www.top500.org/
- NOOP scheduler: http://en.wikipedia.org/wiki/Noop_scheduler
- Anticipatory scheduler: http://en.wikipedia.org/wiki/Anticipatory_scheduling
- Iyer, S., and P. Druschel. "Anticipatory scheduling: A disk scheduling framework to overcome deceptive idleness in synchronous I/O." In: Proceedings of the 18th ACM Symposium on Operating Systems Principles (Banff, Alberta, Canada, ACM), 2001, https://dl.acm.org/citation.cfm?id=502046&dl=GUIDE&coll=GUIDE
- Deadline scheduler: http://en.wikipedia.org/wiki/Deadline_scheduler
- TCQ: http://en.wikipedia.org/wiki/Tagged_Command_Queuing
- CFQ scheduler: http://en.wikipedia.org/wiki/CFQ
- Axboe, J. "Linux Block IO – Present and Future." Linux Symposium 2004 , vol. 1, 2004, https://www.landley.net/kdocs/ols/2004/ols2004v1-pages-51-62.pdf
- I/O scheduler tests with HDD and SSD: https://www.phoronix.com/scan.php?page=article&item=linux412-hddssd-io&num=1
« Previous 1 2 3
Buy this article as PDF
(incl. VAT)