BFQ (Budget Fair Queuing) I/O Scheduler Improves Linux Systems Responsiveness (Video)

BFQ Scheduler

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:

Now we have access to kybr and bfq:

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:

Verify the scheduler is enabled:

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.

Share this:

Support CNX Software! Donate via cryptocurrencies, become a Patron on Patreon, or purchase goods on Amazon or Aliexpress

ROCK Pi 4C Plus
Notify of
The comment form collects your name, email and content to allow us keep track of the comments placed on the website. Please read and accept our website Terms and Privacy Policy to post a comment.
4 years ago

I can confirm that BFQ is great. Tried it on desktop with kernel and felt substantial decrease of input-reaction lag

Da Xue
Da Xue
4 years ago

Are you using a hard drive or SSD? On SSD my tests always have mq-deadline winning.

4 years ago

I tried it with both

4 years ago

A great article and one that I have found works brilliantly on my S912 box running Coreelec.

This is the thread that I created over at the Coreelec forums about it.

As adamg correctly pointed out though, BFG was introduced in kernel 4.12, whereas CE is running on 3.14 on the S912.

And yet it works brilliantly by removing almost all the bottlenecks that I had before.

4 years ago

The kernel is 3.41.29 and it works.

I’ve tested it with 2 S912 boxes with the same results.

I appreciate that the logic says that it can’t work because it can’t be present but it just does.

As far as 4.12+ is concerned, my understanding is that it’s not practical at this moment for this SOC.

Khadas VIM4 SBC