I/O Schedulers

I/O Schedulers
"What purposes does an i/o scheduler serve?"

  • Minimize hard disk seek latency.
  • Prioritize I/O requests from processes.
  • Allocate disk bandwidth for running processes.
  • Guarantee that certain requests will be served before a deadline.
  • So in the simplest of simplest form: Kernel controls the disk access using I/O Scheduler.
"What goals every I/O scheduler tries to balance?"

  • Fairness (let every process have its share of the access to disk)
  • Performance (try to serve requests close to current disk head position first, because seeking there is fastest)
  • Real-time (guarantee that a request is serviced in a given time)
Description, advantages, disadvantages of each I/O Scheduler

1) Noop

Inserts all the incoming I/O requests to a First In First Out queue and implements request merging. Best used with storage devices that does not depend on mechanical movement to access data (yes, like our flash drives). Advantage here is that flash drives does not require reordering of multiple I/O requests unlike in normal hard drives.

  1. Serves I/O requests with least number of cpu cycles (battery friendly?)
  2. Best for flash drives since there is no seeking penalty
  3. Good throughput on db systems
  1. Reduction in number of cpu cycles used is proportional to drop in performance

2) Deadline

Goal is to minimize I/O latency or starvation of a request. The same is achieved by round robin policy to be fair among multiple I/O requests. Five queues are aggressively used to reorder incoming requests.

  1. Nearly a real time scheduler
  2. Excels in reducing latency of any given single I/O
  3. Best scheduler for database access and queries
  4. Bandwidth requirement of a process - what percentage of CPU it needs, is easily calculated
  5. Like noop, a good scheduler for solid state/flash drives
  1. When system is overloaded, set of processes that may miss deadline is largely unpredictable.

3) CFQ

Completely Fair Queuing scheduler maintains a scalable per-process I/O queue and attempts to distribute the available I/O bandwidth equally among all I/O requests. Each per-process queue contains synchronous requests from processes. Time slice allocated for each queue depends on the priority of the 'parent' process. V2 of CFQ has some fixes which solves process' i/o starvation and some small backward seeks in the hope of improving responsiveness.

  1. Considered to deliver a balanced i/o performance
  2. Easiest to tune
  3. Excels on multiprocessor systems
  4. Best database system performance after deadline
  1. Some users report media scanning takes longest to complete using CFQ. This could be because of the property that since the bandwidth is equally distributed to all i/o operations during boot-up, media scanning is not given any special priority
  2. Jitter (worst-case-delay) exhibited can sometimes be high, because of the number of tasks competing for the disk

4) BFQ

Instead of time slices allocation by CFQ, BFQ assigns budgets. Disk is granted to an active process until it's budget (number of sectors) expires. BFQ assigns high budgets to non-read tasks. Budget assigned to a process varies over time as a function of it's behavior.

  1. Believed to be very good for usb data transfer rate
  2. Believed to be the best scheduler for HD video recording and video streaming (because of less jitter as compared to CFQ and others
  3. Considered an accurate i/o scheduler
  4. Achieves about 30% more throughput than CFQ on most workloads
  1. Not the best scheduler for benchmarking
  2. Higher budget assigned to a process can affect interactivity and increased latency

5) SIO

Simple I/O scheduler aims to keep minimum overhead to achieve low latency to serve I/O requests. No priority quesues concepts, but only basic merging. Sio is a mix between noop & deadline. No reordering or sorting of requests.

  1. Simple, so reliable
  2. Minimized starvation of requests
  1. Slow random-read speeds on flash drives, compared to other schedulers
  2. Sequential-read speeds on flash drives also not so good

6) V(R)

Unlike other schedulers, synchronous and asynchronous requests are not treated separately, instead a deadline is imposed for fairness. The next request to be served is based on it's distance from last request.

  1. May be best for benchmarking because at the peak of it's 'form' VR performs best
  1. Performance fluctuation results in below-average performance at times.
  2. Least reliable/most unstable

7) Anticipatory

Based on two facts:
  • Disk seeks are really slow
  • Write operations can happen whenever, but there is always some process waiting for read operation.
So anticipatory prioritize read operations over write. It anticipates synchronous read operations.

  1. Read requests from processes are never starved
  2. As good as noop for read-performance on flash drives
  1. 'Guess works' might not be always reliable
  2. Reduced write-performance on high performance disks
go time.jpg

credits: droidphile (xda)
edited by arawn
Jul 14, 2012
comnam90 and Robbie Hood like this.