Sunday, July 30, 2017

Linux and its schedulers


Personally I don't like the default CFQ scheduler as a heavy IO process can make the whole system sluggish.  For instance, you will find everything non-responsive while copying a large file.

Luckily, there are alternatives.  You can use either NOOP or Deadline instead.

I use Deadline for my system as it is based on fixed length time-slicing.  With this scheduler, IO tasks are queued up for processing.  When it is its turn, it will be run for a fixed duration.  If the task cannot be completed within the time, it will get suspended and put back to the queue for its next run.  As the execution time is fixed, it means no IO task can hog the IO, i.e. the system can apparently be felt like more responsive.

To permanently change the scheduler, you need to modify your /etc/default/grub file by modifying the line below:

GRUB_CMDLINE_LINUX="elevator=noop"
And then run the update-grub2 to apply the change (see https://blog.codeship.com/linux-io-scheduler-tuning/)

You may also change the scheduler if you are running Linux as a virtualized instance.  It seems NOOP scheduler is more suitable, i.e. letting the host IO to worry about IO scheduling.