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.

Support CNX Software - Donate via PayPal or become a Patron on Patreon

9
Leave a Reply

avatar
3 Comment threads
6 Thread replies
0 Followers
 
Most reacted comment
Hottest comment thread
4 Comment authors
Jean-Luc Aufranc (CNXSoft)JohnDTeslaDa Xue Recent comment authors
  Subscribe  
newest oldest most voted
Notify of
Tesla
Guest
Tesla

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

Da Xue
Guest
Da Xue

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

Tesla
Guest
Tesla

I tried it with both

JohnD
Guest
JohnD

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.

https://discourse.coreelec.org/t/bfq-budget-fair-queuing/6605

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.