How to Change I/O Scheduler in Linux

Linux kernel is one of the most complicated software which is being used variety of systems such as laptops, embedded devices, hand-held devices, Database servers, supercomputers etc., All these kind of devices  demand different type of requirements. Some of the applications require fast response to user input.

As you know, disk is the slowest physical device in Computer world. Even though, SSD disk are available in the market. I/O scheduler enables to access to disk optimized way. Linux kernel has variety of I/O schedulers that greatly influence the I/O performance. There is no the best I/O scheduler over the other. Each I/O scheduler delivers best performance based on application.

For example;  one study observed that the Apache web server could achieve up to 71% more throughput using the anticipatory I/O scheduler. On the other hand, the anticipatory scheduler has been observed to result in a slowdown on a database run. (http://www.admin-magazine.com/HPC/Articles/Linux-I-O-Schedulers)

Currently Linux has several I/O schedulers which are;

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

 

I will not get into more detail on this post, but if you really wonder you can find in the link.

How to see active I/O Scheduler?

On my system active I/O Scheduler is CFQ. Shows that the current I/O scheduler (in square brackets) is cfq.

tesla@otuken:~$ cat /sys/block/sda/queue/scheduler
noop deadline [cfq]

How To change I/O Scheduler?

To change the scheduler, just echo the name of the desired scheduler

root@otuken:~# echo noop > /sys/block/sda/queue/scheduler
root@otuken:~# cat /sys/block/sda/queue/scheduler 
[noop] deadline cfq 

Kernel, does not change the I/O scheduler immediately  before all of the requests which belong to the previous one are  completed.

How to change I/O scheduler in Grub and Grub2?

https://access.redhat.com/solutions/32376