Ubuntu: Why does Ubuntu 16.04 set all drive IO schedulers to “deadline”?



Question:

I just installed Xubuntu 16.04-64bit to a second partition on my laptop. I noticed it seemed a bit slow at times, so I checked which IO scheduler it was using for that drive, which turns out to be deadline for all drives. I do have a couple of SSDs and hard drives so I know that "deadline" is best for SSDs and cfq for hard drives.

I booted into 14.04 on another partition and it is using cfq for the rotating drives and deadline for the SSD, as it should. I, also, looked into /etc/udev/rules.d to see if 14.04 was using a rule to configure for the type of drive but it wasn't there, so I assume that the kernel is doing it.

So I'm wondering if this is a bug or are they using "deadline" for everything now?

Update: The comment I wrote about /etc/udev/rules.d was a mistake. In fact I have been using a udev rule to change the scheduler (just as the answer has below) according to rotation type since I started using an SSD, a few years back. I guess I just forgot...getting old. Anyway, one of the references I used was Debian SSD optimization wiki.

Wouldn't it be a good idea if it was included? Just a suggestion!


Solution:1

With the release of 14.04 the default scheduler for the 3.13 kernel was changed from CFQ to Deadline.

There is no longer a separate server kernel and the CFQ sheduler is not suited to many server usage scenarios eg KVM write timeouts. There are even performance regressions on the desktop with USB devices.


Solution:2

The Ubuntu Kernel Team regularly run a lot of analysis of different simulated workloads on different file systems and I/O schedulers to get an idea of the best generic I/O scheduler choice. The general answer is that there is no perfect I/O scheduler choice for a generic configuration across all the different types installs for all the different kinds of media. The salient points to remember are:

  1. Systems are moving to SSD, so noop or deadline are best for these; noop has less CPU overhead than deadline.

  2. CFQ vs Deadline is a hard call. CFQ does allow greater flexibility. However, we found that for a wider range of simulated I/O operations, deadline provided lower latencies and slightly higher higher throughput than CFQ.

  3. I benchmark kernels regularly (each kernel test takes 3+ days to complete) for a range of file systems and I/O schedulers. From this, and other assorted data we try to make an informed decision on the best choice, see:

http://kernel.ubuntu.com/~cking/fs-tests/

There are pros/cons to all I/O schedulers, so any default is not perfect and the Ubuntu kernel team is always willing to have input to the default choice if compelling data and reasons show us to change otherwise.


Solution:3

I don't know why the developers decided to choose deadline as default scheduler, maybe it is because most new computers ship with a SSD, on which normally the systems are installed. You can set the scheduler manually this way, in case you haven't already installed it ... install gksu :

Open a terminal and execute :

sudo apt install gksu    

Then execute this command :

gksudo gedit /etc/udev/rules.d/60-schedulers.rules    

Paste the following text into the empty file and save the changed file.

# set cfq scheduler for rotating disks  ACTION=="add|change", KERNEL=="sd[a-z]", ATTR{queue/rotational}=="1", ATTR{queue/scheduler}="cfq"    # set deadline scheduler for non-rotating disks  ACTION=="add|change", KERNEL=="sd[a-z]", ATTR{queue/rotational}=="0", ATTR{queue/scheduler}="deadline"    

Reboot the operating system and now you are using the optimal schedulers for HDDs and SSDs.


Note:If u also have question or solution just comment us below or mail us on toontricks1994@gmail.com
Previous
Next Post »