What is a I/O Schedulers?
Input/output (I/O) scheduling is the method that computer operating systems use to decide which order block I/O operations will be submitted to storage volumes. I/O Scheduling is sometimes called ‘disk scheduling’.
I/O schedulers can have many purposes depending on the goal of the I/O scheduler. Some common ones are:
- To minimize time wasted by hard disk seeks
- To prioritize a certain processes’ I/O requests
- To give a share of the disk bandwidth to each running process
- To guarantee that certain requests will be issued before a particular deadline
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.
- Serves I/O requests with least number of cpu cycles. (Battery friendly?)
- Best for flash drives since there is no seeking penalty.
- Good throughput on db systems.
- Reduction in number of cpu cycles used is proportional to drop in performance.
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.
- Nearly a real time scheduler.
- Excels in reducing latency of any given single I/O.
- Best scheduler for database access and queries.
- Bandwidth requirement of a process – what percentage of CPU it needs, is easily calculated.
- Like noop, a good scheduler for solid state/flash drives.
- When system is overloaded, set of processes that may miss deadline is largely unpredictable.
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.
- Considered to deliver a balanced i/o performance.
- Easiest to tune.
- Excels on multiprocessor systems.
- Best database system performance after deadline.
- 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.
- Jitter (worst-case-delay) exhibited can sometimes be high, because of the number of tasks competing for the disk.
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.
- Believed to be very good for usb data transfer rate.
- Believed to be the best scheduler for HD video recording and video streaming. (because of less jitter as compared to CFQ and others)
- Considered an accurate i/o scheduler.
- Achieves about 30% more throughput than CFQ on most workloads.
- Not the best scheduler for benchmarking.
- Higher budget assigned to a process can affect interactivity and increased latency.
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.
- Simple, so reliable.
- Minimized starvation of requests.
- Slow random-read speeds on flash drives, compared to other schedulers.
- Sequential-read speeds on flash drives also not so good.
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.
- May be best for benchmarking because at the peak of it’s ‘form’ VR performs best.
- Performance fluctuation results in below-average performance at times.
- Least reliable/most unstable.
Based on two facts
i) Disk seeks are really slow.
ii) 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.
- Read requests from processes are never starved.
- As good as noop for read-performance on flash drives.
- ‘Guess works’ might not be always reliable.
- Reduced write-performance on high performance disks.
ROW stands for “READ Over WRITE”which is the main requests dispatch policy of this algorithm. The ROW IO scheduler was developed with the mobile devices needs in mind. In mobile devices we favor user experience upon everything else,thus we want to give READ IO requests as much priority as possible. In mobile devices we won¡¯t have as much parallel threads as on desktops. Usually it¡¯s a single thread or at most 2 simultaneous working threads for read & write. Favoring READ requests over WRITEs decreases the READ latency greatly. The main idea of the ROW scheduling policy is: If there are READ requests in pipe – dispatch them but don’t starve the WRITE requests too much. Bellow you¡¯ll find a small comparison of ROW to existing schedulers. The test that was run for these measurements is parallel read and write.