How to get I/O priority to work on Ubuntu?
Ubuntu has ionice
, but as far as I can tell, it does absolutely nothing.
I suspect this is because Ubuntu replaced cfq with deadline and deadline doesn't support priorities.
Is there any possible way to have prioritized I/O on Ubuntu anymore?
EDIT: The context is that I have a database restore that easily consumes all my I/O and renders my system unusable until it has finished. I'd like it to remain usable for other tasks.
Solution 1:
You have to change your scheduler from deadline
to cfq
.
You can do that per blockdevice and non permanent via
sudo echo cfq > /sys/block/<blockdevice>/queue
Or for the whole system, permanent via grub
, with adding the elevator=cfq
parameter to the grub commandline options.
This is an excellent post explaining how you can do that.
What the drawbacks of such a change are is better covered elsewhere.
The TL;DR is
According to the test results, each scheduler has different advantages over others. CFQ scheduler is suitable for the systems that require balanced I/O access and do not need process prioritization. Deadline scheduler has better performance on read-intensive works. Noop is for the systems on the cloud or hypervisors. BFQ performs better on interactive use-case scenarios. Noop is the simplest scheduler and it is considered to have the potential for optimized new implementations targeting SSD block devices.