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

  1. TOP500: https://www.top500.org/
  2. NOOP scheduler: http://en.wikipedia.org/wiki/Noop_scheduler
  3. Anticipatory scheduler: http://en.wikipedia.org/wiki/Anticipatory_scheduling
  4. 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
  5. Deadline scheduler: http://en.wikipedia.org/wiki/Deadline_scheduler
  6. TCQ: http://en.wikipedia.org/wiki/Tagged_Command_Queuing
  7. CFQ scheduler: http://en.wikipedia.org/wiki/CFQ
  8. 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
  9. I/O scheduler tests with HDD and SSD: https://www.phoronix.com/scan.php?page=article&item=linux412-hddssd-io&num=1

Buy this article as PDF

Express-Checkout as PDF
Price $2.95
(incl. VAT)

Buy ADMIN Magazine

SINGLE ISSUES
 
SUBSCRIPTIONS
 
TABLET & SMARTPHONE APPS
Get it on Google Play

US / Canada

Get it on Google Play

UK / Australia

Related content

  • Linux I/O Schedulers

    The Linux kernel has several I/O schedulers that can greatly influence performance. We take a quick look at I/O scheduler concepts and the options that exist within Linux.

  • Linux Storage Stack
    Abstraction layers are the alpha and omega in the design of complex architectures. The Linux Storage Stack is an excellent example of well-coordinated layers. Access to storage media is abstracted through a unified interface, without sacrificing functionality.
  • Defining measures
    IOPS is mentioned quite often when benchmarking and testing storage systems, but what does it really mean? We discuss and explain what an IOPS is and how to measure it.
  • What is an IOPS Really?

    IOPS is mentioned quite often when benchmarking and testing storage systems, but what does it really mean? We discuss and explain what an IOPS is, and how to measure it.

  • Optimizing utilization with the EDF scheduler
    The superior "Earliest Deadline First" task scheduling method has been part of Linux since kernel 3.14.
comments powered by Disqus
Subscribe to our ADMIN Newsletters
Subscribe to our Linux Newsletters
Find Linux and Open Source Jobs



Support Our Work

ADMIN content is made possible with support from readers like you. Please consider contributing when you've found an article to be beneficial.

Learn More”>
	</a>

<hr>		    
			</div>
		    		</div>

		<div class=