Preload is an “adaptive readahead daemon” that runs in the background of your system, and observes what programs you use most often, caching them in order to speed up application load time. By using Preload, you can put unused RAM to good work, and improve the overall performance of your desktop system.
Installing Preload on Ubuntu is easily done with the command:
sudo apt-get install preload
Preload is in the package repositories of many different managers, so users of other distributions should check their appropriate package managers to see if it’s available. If not, you can always install Preload via its page on SourceForge.net
Once installed, Preload will start, and no further action is necessary, but read on for configuration options, to learn how to monitor Preload’s activities, and see what kind of improvements Preload will bring to your system.
The configuration file for Preload is kept in /etc/preload.conf and the default values should be fine for most people. But if you want to tweak the operation of Preload, an explanation of the options is available in the configuration file as well as in the paper written by its developer, Behdad Esfahbod.
Some common options available are:
|model.cycle||20 [seconds]||How often Preload will query your system to update it’s model about programs and libraries to cache.|
|model.halflife||168 [hours]||How often Preload will begin to “forget” about old data; for each halflife, the statistical relevance of the current model loses 50% of its importance.|
|model.minsize||2000000 [bytes]||The minimum amount of system calls an application makes for it to be considered by Preload. A smaller number will mean Preload caches smaller applications, while to make Preload cache only larger applications, increase this number.|
The forumula used to determine the maximum available memory available to Preload is:
(Total RAM x model.memtotal) + (RAM available at start x model.memfree) + (Cached memory x model.memcached)
- model.memtotal -10%
- model.memfree 100%
- model.memcached 30%
As I noted previously, the default values should be fine for most people, and you really shouldn’t change these values unless you have a specific purpose in mind.
I’ve heard concerns about Preload’s RAM usage, so I want to make it clear that Preload will not drain your system memory! On my system with 1GB of RAM, preload has given itself 83670kb as it’s maximum available memory size; and of that, it’s only using 35% of that at the moment!
If you want to check up on what resources Preload is using, you can monitor its logfile by running:
sudo tail -f /var/log/preload.log
By default (you can manually set the verbosity of Preload with the “-V” flag; for more information, check Preload’s man page) this won’t tell you much information about Preload except for the amount of memory it has allocated and how many files it’s watching. If you want more information about the specific files that Preload is caching for you, look at this file:
sudo less /var/lib/preload/preload.state
The beautiful thing about Preload, however, is that you can ignore these files completely; you might want to check up on the log every once and a while, just to make sure that it’s running, but Preload will happily sit in the background and stay out of your way.
By the numbers
It’ll take a little while before Preload starts to understand your usage patterns, so don’t expect to see a drastic change in performance right away. Also, if you’re just opening/closing applications repetitively, your computer will store those files in cache anyway (this is called a “warm” load), so you won’t see any difference in speed there. You will, however, see a speed improvement if, for example, you use a program intermittently; these programs will startup faster than without Preload.
The author of Preload, Behdad Esfahbod, has written a paper in which he provides some sample figures for the speed effects of Preload:
|Application||“Cold” Startup Time||Preloaded Startup Time||% Improvement|
|Gedit Text Editor||6s||4s||33%|
Or, for those that prefer graphs to tables:
Keep in mind these numbers are not representitive of current hardware. Modern machines will probably beat the raw timing of these numbers in even cold-start times, but obviously will still see an improvement in speed with Preload (I wasn’t able to find any modern benchmarks to compare, but I imagine they will be similar in terms of percent of speed improvement).
As you can see, larger applications benefit more from Preload, although all applications do benefit at least a little bit. Since Preload is configured to start during bootup, even the amount of time it takes to login to a complete desktop is enhanced by Preload. Keep in mind these numbers were generated several years ago! Modern machines will probably beat these numbers in even cold-start times, but obviously will still see an improvement in speed with Preload! For more information, read the developer’s thesis paper.
Preload can provide a great improvement in application startup time; since most modern machines have a good deal of memory to spare, Preload puts this RAM to good use. I highly recommend installing Preload on your desktop machine, and although it may take a little while for the daemon to learn your habits before your see any real performance improvement, it’s a great tool that increases the speed of your system while staying in the background, out of your way.