How to Make GNU/Linux (Fedora 22) More Responsive?

Even though Hard disk drives are getting faster and faster, they’re still far behind compared to the speed at which other major hardware components of your computer operate (the CPU, GPU, RAM…). And since the hard disk is also the primary storage device where all your data is located, other more faster components, such as the CPU, has to literally ‘wait’ till data is first processed by the hard disk (say loading a program to RAM), before it can work on it.

So the point is, having not just a faster hard disk drive (whether it’s a rotational media or a Solid-state drive etc), but intelligently (effectively) managing the read/write requests send to it, can have a major impact on the system’s responsiveness. The software that’s involved in making those decisions is called the I/O scheduler, and each hard drive comes with one embedded into its BIOS chip.

But operating systems include one (or more) of their own (with added optimizations of their own), since they cannot customize the one that sits on the BIOS of the disk drive. Operating systems such as GNU/Linux has always included multiple I/O schedulers and nowadays it comes with three, commonly knows as: ‘NOOP’, ‘Deadline’ & ‘CFQ’. Most kernels use ‘CFQ’ by default as it’s the most conservative of the bunch. But depending on the technology used in your storage media, it might choose a different one (‘Deadline’ for instance, is better suited for SSD, or so they say).

OS Responsiveness test (Fedora 22)

Still, I couldn’t help but notice that under certain conditions, GNU/Linux slightly lacked that magical touch Microsoft Windows (especially from and after XP) showed when it came to being responsive under heavy disk I/O load. Sure there wasn’t a huge margin, still, it felt like there was some room for improvement (there always is 🙂 ).

So in my research, about three years ago, I came up with another disk I/O scheduler called BFQ that’s specifically designed to address this issue. After some reading and seeing some of the results, I was hooked into it!. Thus I installed it on Ubuntu 12.10 (back then) and was delighted with the improvements.

Since then, I’ve switched to Fedora (22) as my main operating system, and I thought, an article featuring BFQ and how to install it on Fedora 22 might come in handy for her users. But before I’m going to tell you how you can install it (it’s easy), please allow me as always, to share you with some of my own simple tests and their results as somewhat of a proof of what BFQ can actually do.

The tests are very simple. First I installed a fresh Fedora 22 into my test partition (one that I use to review all the operating systems) because I wanted a clean system. Then I boot into the OS a few times, letting things to settle down (you know, let the apps be done with creating configuration settings when run for the first time etc) and then I decided to run two tests, where both tests included copying a file (about 1.5GB) within my ‘Home’ folder because I wanted the HDD to get busy.

1). The first test is to wait 4 seconds after the file copy starts, and then open Firefox web browser and measuring how long the OS takes to open it. But before running it, I made sure Firefox will open a ‘Blank page’ and not an actual web page. And, after running the test, I cleared all of its cache (history, save passwords, offline-data etc) and rebooted the computer, all to keep the accuracy levels high, before running it again. This way, I ran it five times, for calculating average readings.

2). The second test involved opening LibreOffice Writer. And before running this test, on a previous instance, I opened LibreOffice Writer because when you run it for the first time, it’s slow because it has to create few startup configurations etc which could’ve affected the purity of the readings otherwise. Here too I waited four seconds after the file copying started, before attempting to open it, and rebooted the computer between each five tests as well.

Then I installed BFQ on Fedora 22 and ran the same tests on it. And based on all the data I gathered, I came up with the below two graphs so one can easily compare the performance of the two disk I/O schedulers and see the results for themselves.

(P.S: Please note that I used the default GnomeShell and added Firefox (added by default) & LibreOffice Writer to the Dash because it’s easier to open them that way).

Firefox open-up delay under CFQ & BFQ…

Firefox open-up delay under CFQ & BFQ

As you can see, under the same disk work load, BFQ was able to open-up Firefox web browser 39.3% faster than CFQ did!. This is no surprise to me since I’ve already seen the same kind of results under Ubuntu.

LibreOffice Writer open-up Delay (CFQ vs BFQ)…

LibreOffice Writer open-up delay under CFQ & BFQ

Here too, as anyone can clearly see, BFQ outperformed CFQ by a big margin by opening up the LibreOffice Writer application 54.7% faster! (Not only on these occasions, overall, when the disk drive was dealing with heavy loads, the OS was much more responsive under BFQ than it when was under CFQ, obviously).

Now, coming back to the actual installation… There are many kernels available with BFQ but I prefer the one called ‘pf-kernel’. Mainly because in addition to BFQ, it also packs a couple of other utilities that are also known to improve the system’s responsiveness such as the BFS task scheduler (that which decides priority of processes) for instance. And pf-kernel, is available via third-party repository for Fedora 22, 21 & 20 users. But here I’ll be focusing on how to install it on Fedora 22.

Step 1: First of all, let’s enable the repository (a big thanks goes to Pavel for providing it). For that, open-up the terminal window and enter the below command:

sudo rpm -ivh http://rpm.hubbitus.info/Fedora22/Hubbitus-release-22-latest.noarch.rpm

Update (2016-01-21): Many users have complained that they were unable to install the pf-kernel even after adding repository. I looked into the issue and found that one of the mirrors holding the packages was not responding. Luckily I came up with a solution. All you have to do is to run the below command next which will open the file we just downloaded in text editor GUI. Then we’ll simply change the mirror to a working one.

sudo gedit /etc/yum.repos.d/Hubbitus.repo

Now look for a text line that has the below text:

http://rpm-mirror.hubbitus.info/Fedora$releasever/

Correcting the Hubbitus_repo to a working one (Fedora 22)

Simply remove -mirror (only that) from that text, save the change in text editor and close its window. That’s it, now you should be able to carry out rest of the installation. Good luck.

Step 2: Now, since Pavel updates the repository frequently, I cannot give you the exact command to install the latest available pf-kernel since due to the version, its name keeps changing. But luckily, I can show you how to find the currently available pf-kernel and then you can simply copy-&-paste it, for installing. For that, enter the below command:

sudo dnf list available kernel

This will show the currently available (& not yet installed) kernel list. In this output, look for the name that ends with ‘bfs.bfq.fc22’ as shown in the below screenshot.

Installing the pf-kernel in Fedora 22
Here of course, all the kernel names are the same (though each one differs in terms of the CPU architecture, as you can see from the left side of their names: kernel.armv7hl, kernel.i686 etc)…

Now simply copy the whole name (as highlighted in the screenshot) and then paste it at the end of the below command, without spaces:

sudo dnf install kernel-

To make it easier for you to understand, in this occasion, the command should as follows:

sudo dnf install kernel-4.1.9-200.hu.1.uksm.bfq.bfq.fc22

This will install the kernel and will add an entry to the GRUB boot menu as well.

Step 3: However, to enable BFQ there is one more thing that we have to do. Now this was not necessary in Ubuntu because as soon as the installation finished, you reboot the computer and select the BFQ kernel from the boot-menu and you’re good to go. But with this kernel (my best guess is that it has something to do with the way it was compiled), we have to add a configuration file so that BFQ is loaded and used as the default I/O scheduler.

For that, enter the below two commands (one after the other) into the terminal window:

sudo touch /etc/tmpfiles.d/set_IO_scheduler.conf

 

su -c 'echo "w /sys/block/sda/queue/scheduler - - - - bfq" > /etc/tmpfiles.d/set_IO_scheduler.conf'

Now you’re done. Now reboot the computer, choose the BFQ kernel from the GRUB menu (it should be selected as the default one) and enjoy the BFQ awesomeness! 😀 .

(P.S: Please remember that, this way, BFQ will be applied to your primary hard disk drive only and won’t apply to all the drives attached to your computer. If you want to enable it on all the drives (say that you have a gaming desktop computer with multiple disk drives), then you’ll have to replace the ‘/sda’ part of the last command with its device path, and append it to that configuration file. I don’t think this is a huge burden for most users since we usually use a single drive as the primary one.

Secondly, just like when you install any new non-official kernel, if you had software applications such as VirtualBox or Nvida or AMD/ATI GPU drivers with custom kernel modules, then you’ll have to re-build them as well).

16 thoughts on “How to Make GNU/Linux (Fedora 22) More Responsive?

  1. Great article, simple and effective.
    With the command:
    rpm -ivh http://hubbitus.info/rpm/Fedora22/Hubbitus-release-22-latest.noarch.rpm
    I obtain this:
    Retrieving http://hubbitus.info/rpm/Fedora22/Hubbitus-release-22-latest.noarch.rpm
    curl: (22) The requested URL returned error: 404 Not Found
    error: skipping http://hubbitus.info/rpm/Fedora22/Hubbitus-release-22-latest.noarch.rpm – transfer failed

    Anyway the rpm’s are here:
    http://rpm.hubbitus.info/Fedora22/kernel-pf/

    Newly thanks for you efforts and yes I have now a more responsive OS 🙂

      • Hi,
        when i try to search for the kernel i still get an error saying:
        Hubbitus-F22′ from ‘http://hubbitus.info/rpm/Fedora22/, http://rpm-mirror.hubbitus.info/Fedora22/‘: Cannot download repomd.xml: Cannot download repodata/repomd.xml: All mirrors were tried fallita, disabilitazione in corso.
        Is a temporary problem with the repo?
        Thanks

        • Hi Guido,

          Even though there are two lines, it’s actually a single command and you’ve only copied the first line 🙂 . So again, please use the complete command which is this one (again note, there are two lines due to the width of the blog theme):

          sudo rpm -ivh http://rpm.hubbitus.info/Fedora22/Hubbitus-release-22-latest.noarch.rpm

  2. I would like to give the pf Kernel a try but I’m hitting the exact same problems as Guido, none of the suggestions resolve the issues, through a little investigation I am finding 502 errors (Bad Gateway). Have tried Cleaning and Rebuilding the DB Cache, but no joy.
    Fedora 22 KDE 64 Bit, any help would be much appreciated .

    • Hi Rx,

      You’re right, there seems to be some issue with the mirror. Unfortunately there’s pretty much nothing I can do to fix it. If I come across another trusted pf-kernel build, I’ll update the article.

      Update: Actually I found the solution. I’ve updated the article, please follow the instructions now and now they should work (yes I was able to install the bloody pf-kernel 😛 on Fedora 22).

      P.S: Sorry about the late response.

    • Hi Emanuel,

      What exactly did you mean by ‘…software that needs to reinstall?’

      If we’re talking about Nvidia driver and Virtuabox etc then most of the time, the new Kernel should be able to re install them into its system automatically (as long as the source codes for these are put in the proper Kernel source directory, which is the case with major applications).

  3. I’m trying to install this kernel on fedora 24 but

    sudo list available kernel

    list these two only

    kernel.armv7hl 4.7.4-200.hu.2.pf4.fc24 Hubbitus-F24
    kernel.src 4.7.4-200.hu.2.pf4.fc24 Hubbitus-F24

    should I proceed with
    sudo dnf install kernel-4.7.4-200.hu.2.pf4.fc24
    ?

    • Yes, it seems like the correct package.

      P.S: You used the following command while enabling the repository? (because the one in the article is a bit old and it’s for Fedora 22):

      sudo rpm -ivh http://rpm.hubbitus.info/Fedora24/Hubbitus-release-24-latest.noarch.rpm

Leave a Comment