I Have a Schedule to Keep – IO Schedulers

The Linux kernel has several different IO schedulers. This article provides an introduction to the concept of schedulers and what options exist for Linux.

It almost goes without saying that the Linux kernel is a very complex piece of software. It is used in embedded devices that need real-time performance, hand-held devices, laptops, desktops, general servers, database servers, video servers, DNS systems, very large supercomputers, and on and on. All of these uses for the kernel have very different requirements. Some require the system be responsive to user input so you don’t interrupt streaming music or video or other interactivity. At the same time there are requirements for good IO performance (throughput, IOPS, etc.) and for some workloads, these requirements are very high. To make sure that there is balance within the system for all users and processes, there is a concept of schedulers within the kernel.

The schedulers do exactly what the title says — they schedules activities within the kernel. Since this column is all about IO, the scheduler of interest is, aptly enough, the IO scheduler. This article discusses the IO scheduler concepts and the various options that are available.

Introduction – IO Scheduler Concepts

Virtually all applications running on Linux do some sort of IO. Even surfing the web produces a great number of small files that are written to disk. Without an IO scheduler, every time there is an IO request, there is an interrupt to the kernel and the IO operation is performed. More over, you can get a great mix of IO operations that move the disk head around the disk to satisfy read and write operations to different blocks on the drives. Perhaps more importantly, over time the disparity in the performance of disk drives and the rest of the system has grown very rapidly meaning that IO has become more important to overall system performance. As you can imagine when the kernel has to address the interrupt so any kind of processing or interactive work is paused. Consequently the system may appear unresponsive, or it may appear that the system has slowed down.

How do you schedule the IO requests to preserve the interactivity while also ensuring good IO performance? The answer, as with most things, depends upon the workload. In some cases it would be nice to be able to do IO while doing other things. In other cases, it is desired to do IO as fast as possible. To balance these two very different workloads or to ensure that one workload is not emphasized for others (unless you intend it that way), the concept of the IO scheduler was born (actually it’s a pretty old concept).

Scheduling IO events has many pieces to it that must be addressed. For example, the scheduler may need to store the events for some future execution in some sort of queue. How it stores the events, possibly reordering the events, the length of time it stores the events, does it execute all stored events when some condition is reached, does it execute events at some regular interval, etc, are all very crucial aspects of the scheduler. Exactly how these various aspects of the scheduler are implemented can have a huge impact on the overall IO performance of the system and the perception people have when interacting with the system.

Defining the function or role of the system is probably the best place to start when considering scheduler design or tuning existing schedulers. For example, you should know if the target system is an embedded device, a hand-held device, a laptop, desktop, server, supercomputer, database server, video server, and on and on. Knowing this allows you to define what your goals are for the scheduler.

For example, if the target system is a desktop that is doing some web surfing as well as perhaps watching a video or listening to music, and maybe even playing a game. Seems simple, but this has enormous implications. For example, if you watching a video or listening to music or playing a game, you don’t want it to be interrupted and you don’t want any frames to be dropped. Nothing like a video that pauses, plays, pause, plays, to make you sea-sick in a hurry. Or you might be ready to blow the head of a mutant zombie and the system pauses while you are firing and when the system comes back up the zombie has removed your character’s head. And while “stuttery” music may be a genre to some, in general, it’s quite annoying. So, if your target system is a desktop and you want to have as little interactive interruption as possible, then this has a great influence on the design of the scheduler.

One important advantage that IO scheduling gives the system is that it allows you to store events and even possibly reorder them for faster IO. Since the time it takes disk IO to happen can be much slower than other aspects of the system, this can produce contiguous IO requests which can improve performance. Newer file systems are even incorporating some of these concepts so that they can reorder the operations to make things easier and faster for the storage devices. You can even extend these concepts to make the system better adapt to the unusual properties of SSDs.

There are some typical techniques that can be to help IO schedulers. These techniques are:

  • Request Merging: In this concept, adjacent requests are merged together to reduce disk seeking and to increase the size of the IO syscalls (usually resulting in higher performance).
  • Elevator: The requests are ordered based on their physical location on the disk so that the seeks are in one direction as much as possible.
  • Prioritization: This allows the requests to be put into some sort of priority order. The details of the ordering are up to the IO scheduler.

In addition almost all IO schedulers take into account resource starvation so that all requests are eventually serviced.

Linux IO Schedulers

There are currently four IO schedulers in the Linux kernel.

  • NOOP
  • Anticipatory
  • Deadline
  • Completely Fair Queuing (CFQ)

Comments on "I Have a Schedule to Keep – IO Schedulers"

Every after in a while we opt for blogs that we read. Listed below would be the latest websites that we select.

We like to honor quite a few other net websites around the internet, even though they aren?t linked to us, by linking to them. Under are some webpages really worth checking out.

your site in web explorer, may check this? IE nonetheless is the market leader and a good element of folks will pass over your magnificent writing because oof this problem.

Although web-sites we backlink to below are considerably not associated to ours, we feel they are basically worth a go by, so possess a look.

Every when inside a even though we choose blogs that we study. Listed beneath are the newest sites that we pick.

Very handful of websites that take place to become in depth below, from our point of view are undoubtedly nicely really worth checking out.

Here is a superb Blog You may Obtain Interesting that we encourage you to visit.

That would be the end of this write-up. Right here you will obtain some websites that we assume you?ll appreciate, just click the links.

I just want to say I am new to blogging and truly enjoyed you’re web blog. Most likely I’m want to bookmark your site . You amazingly come with perfect well written articles. Thanks a bunch for revealing your blog site.

Very few web sites that transpire to become comprehensive below, from our point of view are undoubtedly effectively really worth checking out.

Very handful of web-sites that occur to become comprehensive below, from our point of view are undoubtedly very well worth checking out.

Check below, are some absolutely unrelated internet websites to ours, nonetheless, they’re most trustworthy sources that we use.

We came across a cool web-site that you may well appreciate. Take a appear if you want.

Always a large fan of linking to bloggers that I love but don?t get quite a bit of link adore from.

Here are a few of the internet sites we advocate for our visitors.

Just beneath, are a lot of absolutely not related web sites to ours, having said that, they may be certainly really worth going over.

We came across a cool site that you just may well delight in. Take a appear should you want.

We came across a cool web-site which you may enjoy. Take a look when you want.

Below you?ll locate the link to some web-sites that we consider you should visit.

Check below, are some totally unrelated websites to ours, however, they may be most trustworthy sources that we use.

Although web sites we backlink to beneath are considerably not associated to ours, we really feel they’re essentially really worth a go through, so have a look.

Always a huge fan of linking to bloggers that I appreciate but really don’t get a great deal of link enjoy from.

Just beneath, are a lot of absolutely not connected web pages to ours, nonetheless, they may be surely really worth going over.

Just beneath, are several absolutely not related internet sites to ours, nonetheless, they are surely really worth going over.

Check beneath, are some absolutely unrelated websites to ours, even so, they’re most trustworthy sources that we use.

We came across a cool website that you could love. Take a look if you want.

Every the moment inside a although we decide on blogs that we read. Listed beneath would be the latest web-sites that we select.

That will be the end of this report. Right here you will find some web sites that we assume you?ll enjoy, just click the links.

Below you?ll come across the link to some internet sites that we assume you need to visit.

Leave a Reply