Storage is normally the slowest part of a system, and operating systems such as Linux try to limit I/O access with “tricks” like caching. The I/O scheduler may also matter if you have multiple programs accessing the same drive, and in Linux 4.12 implemented two new multi-queue block I/O schedulers, namely BFQ (Budget Fair Queuing) and Kyber that are meant to improve the performance of the systems. If you’re using Linux 5.2 you may even get further improvements since performance tweaks make application start-up times under load to be up to 80% faster.
I have never seen BFQ in action so far, but earlier this year, Paolo Valente, who is working for Linaro, made a video with an Acer Chromebook 15 showing Google Chrome launch time using the default mq-deadline schedule, and bfq-mq scheduler.
The test involves writing a 1.5GB file to the drive with dd, and clicking on the Google Chrome icon to start it up. With the mq-deadline scheduler, it takes several seconds to launch Chrome, while with bqf-mq the launch is almost instantaneous.
Some noted he did not clear the cache for the second run with the BFQ scheduler, but Paolo explained it did not matter:
In the first place I executed this test dropping caches, then found out that results are invariant w.r.t. dropping or not dropping. So, for fear of being too pedantic, I didn’t take the dropping step any longer in the version of the test I recorded.
Seeing a demo is all well and good, but I’d like to enable it on my systems to see how it performs. I’m running Ubuntu 18.04.3 LTS with Linux 5.0.0.
Oh. Why do I only have mq-deadline options? Ubuntu Wiki explains how to enable multi-queue schedulers:
sudo modprobe bfq-iosched
sudo modprobe kyber-iosched
Now we have access to kybr and bfq:
[mq-deadline] kyber bfq none
I’m not sure how to enable bfq-mq like in the Chromebook demo though. Nevertheless, if you want to enable bfq, simply run the following command:
echo "bfq" | sudo tee /sys/block/sda/queue/scheduler
Verify the scheduler is enabled:
mq-deadline kyber [bfq] none
We’re good to go. I haven’t done much testing yet. I’ll provide some feedback after playing around a bit more. If you have already checked it out, please do comment about your experience.
It may also be worthwhile to read “Best I/O scheduler to use” from the Ubuntu Wiki page linked above, as “deadline” is the recommended scheduler for basically all use cases.
Jean-Luc started CNX Software in 2010 as a part-time endeavor, before quitting his job as a software engineering manager, and starting to write daily news, and reviews full time later in 2011.