‘BFQ’ Loads Programs Extremely Fast under Heavy Disk ‘I/O’ Activity (Ubuntu)

In computing, when it comes to delivering excellent performance and stability, both software and hardware go hand in hand. Meaning that, even if you have the most powerful hardware, if your software or the operating system, is not properly optimized, then that can still lead to decreased performance & stability.

However, optimizing an operating system is no easy task either, as an OS is actually a collection of software tools, rather than a single entity, and thus, a major flow in a single core utility can negatively affect the entire OS, quite easily.

Take a file system for example. Let’s say that you have a fast spinning, newer hard disk drive etc. Let’s also say the file system is also well designed (less file fragmentation, fast seek times etc).

There is still, another important software utility called the ‘disk I/O scheduler’, that can has a big influence on the performance of a file system, specially under heavy disk I/O workloads.


Let me give you an example …

Nowadays, as computer users, we all multitask (quite heavily, I might add). You might be copying a large file to a different location on your HDD, then at the same time, decided to open an audio file, and then would also double click to open your web browser. And when doing all that, from the background, the operating system might also be receiving its daily software updates as well.

So in situations like these, if the throughput of your hard disk drive (I/O bandwidth) is not ‘shared intelligently’, it can affect the performance negatively. For instance, if the OS decided to give high priority to the file copying process, then the audio player and the web browser might take a long time to load. Or worse, the OS might even lose its ‘responsiveness’, by a lot. And the tool that is in control of managing the disk’s I/O bandwidth is, the ‘disk I/O scheduler’.

So again, supposing that one has a well designed file system & a fast disk drive, the disk I/O scheduler still plays a major role when it comes to maintaining a responsive operating system.

To keep the article as simple (and less boring) as possible, I’ll stop here.

In GNU/Linux, currently there are three main disk I/O schedulers available. They are called ‘CFQ’, ‘NOOP’, ‘Anticipatory’ and ‘Deadline’ (the ‘Anticipatory’ is now removed). Most distributions use the one called ‘CFQ’ (‘Completely Fair Queuing’ scheduler) but it really depends on the need of the users and the type of computing environments that distribution will be used upon.

In the past, Ubuntu’s desktop edition used ‘CFQ’ but with recent versions (including 12.10), ‘deadline’ has replaced ‘CFQ’. I have tested ‘CFQ’ and ‘deadline’, and I can see why ‘deadline’ is being used in Ubuntu, as it gives slightly higher throughput rates (very little) when copying files, and the responsiveness is also better than under ‘CFQ’, when multitasking.


That said, when comparing with Windows, though GNU/Linux is far far better than how it used to be, it still feels a bit less responsive, under heavy disk I/O based multitasking. For example, in Ubuntu, if I were to copy a file and while it is being copied, started to open several programs, then sure it slows down their loading times and it is to be expected.

But if I were to do something similar in Windows, then according to my experience, the OS’s responsiveness (plus the app loading times) is usually better than in Ubuntu, most probably because the disk I/O scheduler in Windows seems to be a bit better at keeping the OS more responsive, even when other disk I/O intensive programs are running from the background.

So out of my frustration, I searched for a solution. And came upon another disk I/O scheduler for GNU/Linux called ‘BFQ’ (it’s actually based on the code of ‘CFQ’). And even before I decided to install it, I got really excited because on its home page it says …

One of the nice features of BFQ is that, according to our results, whatever the load is, the disk is virtually as responsive if it was idle.

For example, even if one or more large files are being read or written, or else one or more virtual machines are performing I/O, starting a command/application takes about the same time as if the disk was idle.

It sounded like the perfect solution ;-), so I decided to install in on my Ubuntu 12.10 and run few tests. Below are their details and the results.



I have a Core i3-2330M CPU, 4GB of DDR3 RAM, 320GB Toshiba SATA hard disk (7200 RPM). The tests were run under Ubuntu 12.10.

What were the tests?

I ran three tests in the default I/O scheduler that comes with Ubuntu 12.10 (‘deadline’) and then ran them all over again with ‘BFQ’ set as the scheduler. I ran each individual test 4 times, to get an average result, and between each test, I rebooted the computer to avoid disk and memory caching.

Test Number 1 …

According to the ‘BFQ’ developer ‘Paolo’, who is an assistant professor of Computer Science (University of Modena and Reggio Emilia, Italy), ‘BFQ’ also has the ability to give slightly higher disk throughput (sometimes 30% more!).

In other words, if I were to copy a file using ‘BFQ’, then it will be copied 30% faster, than other disk I/O schedulers.

Update (11/23/2012): This is actually not 100% accurate. Professor ‘Paolo’ was kind enough to put a comment and correct me. So let me comment him here …

… a disk scheduler can make a difference with respect to another one, in terms of throughput, only if there are at least two competing applications accessing the disk. Otherwise any good scheduler would achieve more or less the same performance, as it basically just passes requests to the disk in the same order as it receives them.

So I decided to test this first (and then move over to testing application loading times under heavy disk ‘I/O’ activity). All I did was very simple, I measured how many seconds Ubuntu takes while copying the Ubuntu 12.10 official disc image (800MB), while no other programs or tasks were running from the background.

I ran this test in both ‘BFQ’ and ‘deadline’. Below is the graph that I created by based on the average values.


As you can see, ‘deadline’ actually copied the file slightly faster than ‘BFQ’ did, though difference is very little (.5 seconds), it can make a difference while moving a big file (50 seconds change for copying 80GB of data). And I could not see ‘BFQ’ improving my disk throughput as claimed.

Test Number 2 …

After the slight disappointment in the first test, I decided to test ‘BFQ’ performance under a heavy disk I/O workload, and how fast a certain application would load.

So the second test involved opening ‘LibreOffice Writer’ while copying a file that was about 2.1 GB.

Note: (for the extreme geeks: This was actually not a real file copy, instead, I used ‘dd’ to create a 2.1GB file with ‘block size’ set at ‘1MB).

Once the 2.1GB file started to copy, I waited for 4 seconds approximately, and then clicked on the ‘LibreOffice Writer’ icon on my ‘Application Launcher, and measured how many seconds it takes for ‘Writer’ to be fully opened.

Again, I ran this test 4 times individually in each disk I/O scheduler and below is the graph based on the average results.


As you can see, the first time I couldn’t believe it actually, as ‘BFQ’ was able to open ‘LibreOffice Write’ application 262% faster than ‘deadline’ could!. And I also noticed two main things.

In ‘BFQ’, the time ‘Writer’ took to load varied a bit. For example, the first time, it took about 18 seconds. But the next time it was reduced to 10 seconds (remember, this is a ‘cold start’ of ‘Writer’. Meaning that I rebooted the PC between each test to avoid any memory Caching), third time 12 seconds and the fourth 17 seconds. And ‘LiberOffice’ started to load with a minimal of delay.

But in ‘deadline’, the variation was minimal (38, 37, 37, 38), though ‘LibreOffice Writer’ actually started to load ‘for real’, after the file copy was finished, as its ‘logo’ was just hanging there while the file was being copied.

Test Number 3 …

This very similar to the above test. To get more accurate results on how well ‘BFQ’ could perform under heavy disk I/O loads, I decided run another test. I also wanted a more practical example, so I decided not to use ‘dd’ to simulate a disk I/O activity.

This time, I copied a real ‘tar archive’ with a size of 1.5GB. And again, 4 seconds after it started to copy, I clicked on the Firefox’s icon on the Application Launcher. Then I measured how many seconds Firefox takes to load, and based on the average value, I came up with the below graph.

Note: (I cleared Firefox’s cache after running each test. Plus, also rebooted the computer too).


Because of the unusual and scary looking difference between the two rivals, I actually ran more than 8 individual tests :). But the results were always same, with ‘BFQ’ opening Firefox 670% faster than ‘deadline’ did!.

Again, I did saw a few variations (seconds) while opening Firefox under ‘BFQ’ (8, 6, 9, 8) where it was quite minimal under ‘deadline’ (53, 52, 52, 52) but when compared the average loading times that ‘BFQ’ delivered, it just made me say, wow!.


How to Install it in Ubuntu ?

I could not find a PPA for adding ‘BFQ” into the Kernel that comes in Ubuntu (12.10). Luckily, there’s another kernel called ‘pf-kernel’ that comes with few ‘patches’ or features that are not included in the mainstream Kernel releases (including the ‘BFS’ task scheduler).

‘pf-kernel’ home page holds a ‘deb’ file that lets you easily install a Kernel that comes with the ‘BFQ’ as the default disk I/O scheduler. To install it, please follow the below steps …

Note: Installing a new Kernel is a bit dangerous thing. I did not encounter any issues (except the Ubuntu boot logo got displayed with a wrong aspect-ratio), but please use it at your own risk. I also don’t know if it will work in other Ubuntu versions either (only tested in 12.10).

Step 1: First of all, head over to this page.

Update (2013/03/21): The above link doesn’t seem to be working anymore and the packages now are provided through here.

Step 2: Then download the latest Kernel package (the one with the name ‘linux-image …’ -- it has both 32-bit & 64-bit packages) & once the downloading completes, double click on it and follow the on-screen details of Ubuntu Software Center to install it.

When all is done, ‘pf-kernel’ will be used as the default one when you click on ‘Ubuntu’ from the GRUB menu. If you want, you can access the original Kernel by clicking on the ‘Advanced options for Ubuntu’ sub menu as well.

How to change between the disk I/O schedulers ?

Though ‘BFQ’ is the default disk I/O scheduler, ‘pf-kernel’ comes with ‘CFQ’, ‘Deadline’ and ‘NOOP’. And if you want, once installed, you can easily switch between the I/O schedulers, and do a bit of a testing by yourself too :). For that, please follow the below steps (via this Ubuntu Forum thread).

Step 1: Open your Terminal window and enter the below command.

gksudo gedit /etc/default/grub

This will open a configuration file of GRUB bootloader.

Step 2: Then locate the below text line.


Step 3: Now simply copy and paste the below code after the existing “quite splash”, as shown below.



Note: You can also use others by simply replacing ‘deadline’ with ‘cfq’, ‘noop’ and ‘bfq’.

Now save your changes and exit the editor.

Step 4: Then enter the below command to properly update the configuration to GRUB.

sudo update-grub

Then wait for the ‘done’ message on the Terminal window.


Then reboot your computer for the changes to take effect. That’s it.

You can use the below command to see which disk I/O scheduler is being used, anytime you want.

cat /sys/block/sda/queue/scheduler


Few closing words …

When comparing with others, ‘BFQ’ is somewhat a newer tool. But that’s nothing compared to what it can do. And its developers have proposed it to the Ubuntu developers too (like 2 years ago). I don’t know why, but for some reason (perhaps it was not that stable back then?), it has not made it.

I too have only tested it on a single computer … so I cannot say much about its stability and other issues in a much broader sense. But from my short experience with it, I can say this much.

If you want to make Ubuntu impressively responsive so that it will open programs pretty fast when the disk drive is busy while attending to other disk I/O intensive tasks, then you should try ‘BFQ’!.

I also do hope that it will make it into Ubuntu, because everyone loves an OS that performs well under multitasking :P.

My tests are very basic ones and if you want more additional details, then please visit this page as it contains some complex tests and their results carried out by professor ‘Paolo’ and ‘Fabio’.

For those who are interested, assistant professor ‘Paolo’ has also created a 15 min video that compares ‘CFQ’ and ‘BFQ’ as well (below).

Good luck.

An RHCE, 'Linux' user with 14+ years of experience. Extreme lover of Linux and FOSS. He is passionate to test every Linux distribution & compare with the previous release to write in-depth articles to help the FOSS community.

37 thoughts on “‘BFQ’ Loads Programs Extremely Fast under Heavy Disk ‘I/O’ Activity (Ubuntu)”

  1. Hi Gayan, doesn’t swapability also play a part in this, with Ubuntu swapability default being the server setting, while a desktop machine works better with a lower setting?

    • Alan,

      You are right, especially if one is trying to open memory hungry apps in a computer that has a smaller RAM.

      However, because I have 4GB of RAM, I use Ubuntu (including the one that I used for these tests) without a Swap file. And while running these tests, most of it (RAM) was free as well.

      So at least in this case, its influence was not a concern. Thanks for bringing that up though :).

  2. Just a quick note. Apart from trivial deficiencies, a disk scheduler can make a difference with respect to another one, in terms of throughput, only if there are at least two competing applications accessing the disk. Otherwise any good scheduler would achieve more or less the same performance, as it basically just passes requests to the disk in the same order as it receives them.

  3. I suggest to install both. The kernel image and the kernel headers.

    The reason is, the kernel headers are needed by “dkms” to compile certain modules.

  4. Hi
    I have been struggling to make opengl work with kernel 3.8.2-pf.
    I have an ati card and it’s fully stable and working under:
    Linux 3.8.0-19-generic #30-Ubuntu
    I installed the amd propietary driver (13.04) by downloading it from the official website and compiling->Installing

    I recompiled the same driver under the patched kernel 3.8.2-pf but when I install it, it seems that it can’t find the kernel source (Which I also installed from the website), nonetheless it finish the install successfully but opengl still doesn’t work.

    Thank you very much for your awesome guides! And hope that I’m just doing something wrong.

    • Hi Jerek’

      First of all, you are welcome :).

      As for your question — I haven’t build a Kernel module for a GPU in a very very long time, because I haven’t had one of those from AMD or Nvidia :). So I’m not exactly sure whether I’ll be much of a help here & I can’t test any of the below steps either.

      Method 1:

      Have you tried manually entering the Kernel source path to the installer ?, if you haven’t then use it in the below format.

      --kernel-source-path=/usr/src/linux-x.x.x/usr/include sh NVIDIA-Linux-x.x.x.run

      Make sure to replace both name & the paths of Kernel & the GPU installer. I found these instructions form this page.

      Method 2:

      If it still fails, then have you tried the method described in the AMD/ATI wiki ?, if you haven’t, then;

      Make sure to install the ‘linux-headers …’ package of the same ‘pf-kernel’ image version that you’ve installed, I don’t think the ‘Kernel-source’ package is really necessary for this.

      Then, if you use the 32-bit Ubuntu 13.04 version, enter the below command (most these packages should be already installed since you’ve already complied a Kernel driver but there could be few that aren’t)

      sudo apt-get install build-essential cdbs dh-make dkms execstack dh-modaliases fakeroot libqtgui4

      If you use 64-bit version, then enter the below one instead;

      sudo apt-get install build-essential cdbs dh-make dkms execstack dh-modaliases fakeroot libqtgui4 lib32gcc1

      Then, re-run the latest AMD/ATI installer by using the below command (replace the correct file path & name accordingly, of course):

      sudo ./amd-catalyst-13.4-linux-x86.x86_64.run --buildpkg Ubuntu/raring

      Then the below one to install it:

      sudo dpkg -i fglrx*.deb

      Then the below one to finish things up:

      sudo aticonfig --initial -f

      I’m pretty sure you know this, but I just wanted to give a decent answer (hopefully). You can find more about from this page if interested.

      Again, I’m not sure if it helps or whether you’ve tried them already but … good luck.

      • Thank you very much for answer! 🙂
        I can’t test it right now because I’m not at home, will test method 1 as soon as I arrive.
        I didn’t do that and think it will most likely fix it because that was the main complain of the installer.
        What I did was the second method.
        Will update with the results when I test it!

    • Hi ‘Marky’,

      No, I haven’t mate. I don’t think it’s fair to compare performance (in general) while running on ‘VBox’ since, as of this occasion, the ‘last’ disk I/O scheduler that will be in charge then will be the one that comes with Windows, instead of ‘BFQ’, is it not ?

  5. Hi, I installed the new kernel in my ubuntu 12.04 system. I think its running fine. But there is a problem. I run my windows 7 on vmware. After installation of the new kernel, vmware is asking me to compile the header files to continue. I downloaded the headerfiles from the link given above, but could not have a progress since the header files are not getting installed. The error shown is given below. Your helps is needed….


    [email protected]:~$ sudo dpkg -i /home/aneesh/Downloads/linux-headers-3.8.2-pf_1_i386.deb
    Selecting previously unselected package linux-headers-3.8.2-pf.
    (Reading database … 709434 files and directories currently installed.)
    Unpacking linux-headers-3.8.2-pf (from …/linux-headers-3.8.2-pf_1_i386.deb) …
    Setting up linux-headers-3.8.2-pf (1) …
    Examining /etc/kernel/header_postinst.d.
    run-parts: executing /etc/kernel/header_postinst.d/dkms 3.8.2-pf /boot/vmlinuz-3.8.2-pf
    ERROR (dkms apport): kernel package linux-headers-3.8.2-pf is not supported
    Error! Bad return status for module build on kernel: 3.8.2-pf (i686)
    Consult /var/lib/dkms/bcmwl/ for more information.
    [email protected]:~$

  6. [email protected]:~$ sudo apt-get install linux-image-generic-ck linux-headers-generic-ck
    Reading package lists… Done
    Building dependency tree
    Reading state information… Done
    E: Unable to locate package linux-image-generic-ck
    E: Unable to locate package linux-headers-generic-ck

  7. Hi, I’ve tried this in Linux Mint 13 which is based on 12.04 LTS. Didn’t work on it and had problems with the CPU unlock….and i noticed that immediately the cpu fan was increasing RMP’s and getting noisy…Reading back i wonder weather this works on 12.04 LTS or just after upgrading to 12.10? It didn’t complain about anything with the install though. I would like to give BFQ a try….as I think it’s maybe also a nice scheduler for SSD from what i read. Any idea how I can get this o work?

    • Hi Gerard,

      I’m not sure what’s exact reason is. Sorry about that.

      On a side note, the ‘pf-kernel’ home page doesn’t list Ubuntu, Linux Mint packages download pages (the links on the article only takes to the old page, but even that is now not displayed on the Home page). S please remember that. There could be other Kernels that come with it, but I haven’t found one yet.

  8. You don’t need to reboot the system just to clear the caches. You can do it by issuing the below command as root

    echo 3 > /proc/sys/vm/drop_caches

    This will free all caches, dentries and inodes

    • Thank you Grozdan, I actually am aware of it, but I’m a little paranoid when it comes to these matters 🙂 (hence the name ‘hectic geek’). I reboot the OS so that I know for sure that I haven’t missed anything.

  9. most probably because the disk I/O scheduler in Windows seems to be a bit better at keeping the OS more responsive, “

    I wonder if it’s not also largely because most (all?) linux’ filesystems are more “spread over” the disk to avoid fragmentation, while Windows’ NTFS and FAT are “sequential”, all files are tightly packed next to each other, at the cost of future fragmentation when they’re edited.

    If that’s true, then we should expect better performance on linux when using tiny/minimal partitions, I guess. I’m not recommending it, I just thought it would be a manner of testing that other than using linux with some fragmentation-prone FS.

  10. Using the pf kernel with BFQ on a multi-disk server has made it much more responsive.
    In normal tasks, I would be transferring data across a network from one or more disks at a time whilst also running various non-intensive background tasks AND browsing folders on various disks on the server.
    With the default kernel and CFQ, I would be waiting up to 5 seconds to change folder on the server, with the pf-kernel, it is now pretty much instant.

  11. ok so here’s the thing:
    when i run
    cat /sys/block/sda/queue/scheduler
    it returns:
    noop [deadline] cfq
    Edited the line to this :
    GRUB_CMDLINE_LINUX_DEFAULT=”quiet splash elevator=bfq”
    yet bfq does not even display in the return command
    i am running
    ubuntu 16.04 LTS
    btw i dont knw wht LTS stands for too
    just had it installed on my pc trying to make my pc perform faster
    i have acer ao725
    amd dual core c60 processor with turbo core technology upto 1.33ghz
    2gb ram
    500 gb hdd
    also i would appreciate any help to make things run faster on my netbook

    • Hi,

      Unfortunately, none of the sources listed here provides a Kernel patched with BFQ for Ubuntu 16.04 LTS (it’s been quite a while since I wrote this article).

    • Where did you get it from?

      P.S: You have to reboot the computer after installing a new kernel. Only after that will it be used as the running (default) kernel.


Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.