‘Effects’ of Using ‘preload’ (‘readahead daemon’) in Ubuntu 13.04

When a user runs a program, the OS first loads its data into the ‘RAM’. And when that program gets terminated, the OS, rather than completely getting rid of it, moves the program and its data into another location on RAM, called the ‘page cache’.

So if the user re-runs the program (say after a short while), then the OS first look for its data in the ‘page cache’, if the data is there (fully or partially), then the program will be loaded extremely faster than the first time it was executed, because it minimizes the need to re-locate/re-load that data from your hard drive or SSD, as they’re very slow, when compared with the speed of the RAM.

So in other words, by intelligently managing the ‘page cache’, an OS can significantly improve the application loading times and the user experience.

One way of optimizing the ‘page cache’, is to use data ‘prefetching’ techniques — the process of loading applications & their data into the ‘page cache’, before they’re demanded by the applications (in GNU/Linux, data ‘prefetching’ is called ‘readahead’).

The ‘page cache’ is managed by the OS’s Kernel, and most operating systems (including GNU/Linux), don’t use ‘aggressive’ data prefectching techniques when managing the ‘page cache’. But if you’re a GNU/Linux user, then you can use tools like ‘preload’ for enabling aggressive data ‘prefetching’.

'preload' man page in Ubuntu 13.04

What is ‘preload’ ?

‘preload’ is a tool that monitors & keeps a history of the user’s most frequently used applications (& the files that those applications load upon their execution). And based that data, it tries to guess what app the user will be opening in the near future & loads the necessary data from you disk drive to the ‘page cache’, before they’re being demanded.

In plain simple terms -- after a while ‘preload’ is installed, you should be able to open your frequently used applications much faster.

‘preload’ is not a new tool but I never really gave it a go, ‘thanks’ to few prejudices that I had over it :). So I decided to try it on a newly installed Ubuntu 13.04 & ran few tests to see how it performs.

This is what I did.

Before installing ‘preload’, I measured the boot-up times of Ubuntu 13.04 and the loading times of 4 applications -- Firefox, GIMP, LibreOffice Writer & Ubuntu Software Center (USC).

So the first time, once the OS booted, I took a note of its boot-up times, let the OS idle. Then I opened Firefox & measured its start-up times (had configured it to open a blank page), closed it, opened GIMP, measured its start-up times, closed it & did the same to LibreOffice Writer and USC.

Once done finished measuring everything, I rebooted the PC & ran the same tests all over again. I followed this ‘cycle’, approximately 5 times, for getting conservative results.

Then I installed ‘preload’, ran the same tests, and took measurements.

However …

As mentioned early, for speeding up the app start-up times, ‘preload’ first need to build a ‘database’ (a ‘probability model’ to be precise). It monitors the run-time of an application (ignores anything that runs below 20 seconds) & the memory usage, for calculating the importance of an application.

So, after installing it, I opened Firefox, GIMP, LibreOffice Writer & USC. And I kept then opened for about 3 minutes. In the mean time, I also switched between each app, here & there, typed few text into Writer, opened a web page on Firefox … you know, tried to emulate a ‘normal’ user session.

Once finished, I rebooted the PC & re-ran the emulation process, all over again. This was also carried out 5 times, so at the end, ‘preload’ should have created a decent database for prefetching files.

Then I started to measure the boot-up times & app loading times, it too I did 5 times. So using the gathered data, I came up with the below graphs.

Boot-up Times

Boot-up times in Ubuntu 13.04 - With & without 'preload'

As you can see, the boot-up times with ‘preload’ installed was slightly slower than without it because ‘preload’ starts while the computer is booting (in ‘user-space’ -- with user privileges) and starts prefetching into ‘page cache’. Still, its effect (negative) is minimal.

You’ll also notice that, if you had read my Ubuntu 13.04 review, the boot-up times without ‘preload’ here & the boot-up times that I mentioned in that post, are also slightly different. That is pretty normal in Ubuntu, due to ‘ureadahead’ I suppose, as the boot-up times varies a bit. And it is for this very reason, that I decided to re-measure the boot-up times, rather than using the data of that review.

Plus, in this occasion, I also had run ‘apt-get’, installed & added GIMP icon to the app laucher etc and sometimes doing things like also changes the boot-up times. I just want you to know that I wasn’t posting any false information on that review!.

App loading times (without & with ‘preload’)

Various pplication loading times with & without 'preload' - Ubuntu 13.04

As you can see, start-up times of Firefox, GIMP & LibreOffice Writer are reduced by 44.4%, 16% & 60.7%, respectively. Firefox & Writer are the heavily affected ones (probably because I was ‘working’ with them a lot, while ‘training’ preload — just a guess a though).

Below is the graph for Ubuntu Software Center.

USC loading times with & without 'preload' - Ubuntu 13.04

As you can see, I don’t know why, but with ‘preload’ the loading times have actually increased (14%). I tested it more than 5 times, to make sure, but it was pretty much the same.

Another thing that’s worth mentioning is that, with ‘preload’ running, sometimes, while loading to the desktop, the Wi-Fi connection was already connected, where in other occasions (without ‘preload’), it takes a few seconds for connecting.

Memory usage

‘preload’ runs as a daemon and under most conditions, it never used more than 2.5-3.1 MiB. But since it does its ‘real’ work inside the ‘page cache’, what’s worth measuring is the ‘page cache’ usage, not the memory used by the ‘preload’ daemon.

It is also worth noting that, almost all the operating systems use all the available ‘free space’ on RAM for the ‘page cache’. And, although the ‘page cache’ plays a major role concerning performance, responsiveness & stability, the OS does not hesitate to purge its content, if an application requests some space on RAM for its execution, when all the ‘free space’ is occupied by the ‘page cache’.

So perhaps it’s because of this subtle ‘negligence’ that, almost all operating systems, when showing memory usage, disregard the ‘page cache’ size & show it as ‘free space’.

However in GNU/Linux, one can monitor the ‘page cache’ usage by using the ‘cat /proc/meminfo’ command and having a look at the value under ‘Cached’, as shown below.

Using Terminal to find 'page cache' size on Ubuntu 13.04
‘Page cache’ size, upon loading the desktop, before installing ‘preload’ …

Below is the initial ‘page cache’ size that I measured upon loading the desktop.

Initial 'page cache' size with & without 'preload' - Ubuntu 13.04 (MiB)

As you can see, after ‘preload’ created its database, then initial ‘page cache’ size got increased around 70%. This is no surprise, I mean, how else can it improve the app loading times :). Also remember that, depending on the complexity of its database, the initial ‘page cache’ size will differ.


Now wait a minute!. How come, that after adding another extra 250MB+ data (in this instance) into RAM, the boot-up speed is not affected by that much ?

The answer is simple actually. ‘preload’ populates the ‘page cache’ in two steps. It first loads few of the data during the boot-up process, and loads rest of the data after the desktop is fully loaded (data loaded here is larger than the one loaded during boot-up).

It is for this reason, the boot-up times is not negatively affected, by that much.


But again, as mentioned above, users don’t have to worry much about the ‘page cache’ size increase, as the OS will get rid its data, depending on the need of the running applications. That said, a busy ‘page cache’ consumes the bandwidth of your RAM & can make the disk drive busy, and if not carefully managed, can slow down the operating system.

This is why it’s better to leave the settings to their default values, although we can tweak ‘preload’ by editing its centralized config file (/etc/preload.conf).

'preload' configuration file - Ubuntu 13.04

Responsiveness & stability

As mentioned above, ‘preload’ works by prefetching files from the disk to the ‘page cache’, which increases disk reads, more than usual. So in a situation like heavy multitasking, would it decrease the stability & responsiveness ?

Well, the best way of knowing is to try it yourself. And as usual, I did a simple stability test. I copied a file about 1.3 GB & while it was copying, I opened ‘Dash’ & did a few searches, opened the ‘System Settings’ window, opened ‘Writer’, USC, GIMP, Firefox etc. So how did it go ?

Well, I couldn’t see a change in the responsiveness. It was, in my experience, pretty much the same.

Testing responsivess with 'preload' - Ubuntu 13.04

Also note that, according to its developers, ‘preload’ has the ability to ‘detect’ when the system is idling & will literally halt prefectching, so the disk drive’s power saving features (‘spin down’ for example) aren’t negatively affected as well.

Final words …

So, as a final word, if you have a reasonably lager RAM & use Ubuntu, and looking for a way to speed up the application loading times, without sacrificing much, then yes, ‘preload’ is worth trying. If you have different opinions, you’re more than welcome to throw in a comment.

You can install it on Ubuntu 13.04, 12.10, 12.04 … by using the below command.

sudo apt-get install preload

Once installed, reboot the computer & use it as usual. When ‘preload’ has gathered enough data, you should see an improvement of your application loading times. Good luck.

Note: The ‘page cache’ analogy that I included is only a basic one as it’s a bit more complicated than that. But it should help most users to get a basic idea, nevertheless.

16 thoughts on “‘Effects’ of Using ‘preload’ (‘readahead daemon’) in Ubuntu 13.04

  1. More overheads? Nah, it’s cool. 😀

    Love the visual effects and responsive GUI on new Ubuntu 13.04 but not suffering few bugs here and there. I don’t really know what Canonical did but I can no longer mount an external NTFS hard drive like I did on 12.04 LTS. Bluetooth is poofed too! Is this some kind of trends on Linux land, man? Every single upgrades break something!

    • Hello mate,

      I think you intended this comment to be posted for the Ubuntu 13.04 but it appeared on this post :). Anyway, sorry about the issues that you’re having, shi* happens.

      • I’m pretty tired, Gayan.

        I’ll wait until 14.04 LTS, if more problems arise, I’ll make the switch to Mac.

        Won’t be reading your posts much after that. Sorry.

          • Try Linux Mint then. Ubuntu core, but has no issues with mounting stuff and bluetooth.

            And has the usual reassuring desktop UI.

            Really, Ubuntu is just one of many linux distributions, have a good look around before wasting cash on a Mac.

  2. Would like to give big thanks for such good review and testing.

    I was considered setup this tool on my workstation with 8 GB RAM + HDD.

    At home I have a notebook with 4 GB RAM + SSD and after I got this feeling about SSD vs HDD perfomance I’m keep looking any options how to improve user experience on my workstation.

Leave a Comment