A A
RSS

Drastically Speed up your Linux System with Preload

Mon, Mar 2, 2009

Tweet this!

Introduction

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.

Installation

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.

Configuration

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:

Option Default Controls
Cache model (system) settings
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.

Memory settings

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!

Monitoring

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
Desktop Login 30s 23s 23%
OpenOffice.org Writer 15s 7s 53%
Firefox 11s 5s 55%
Evolution 9s 4s 55%
Gedit Text Editor 6s 4s 33%
Gnome Terminal 4s 3s 25%

Or, for those that prefer graphs to tables:

Preload stats graph

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). For more information, read the developer’s thesis paper.

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.

Conclusion

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.

Like this post?

21 Responses to “Drastically Speed up your Linux System with Preload”

  1. Nice work there.
    But where your work concentrates on preload, mine concentrates on using xfce Desktop Environment in an existing Ubuntu installation:
    http://opensourcethefuture.blog.co.in/2009/03/02/speed-up-ubuntu

  2. Jonathan says:

    Good point, Sudipto Sarkar – if you really want to speed up your system, an easy way to do that is to choose a lighter desktop environment, and XFCE definitely fits the bill.

    There’s also Xubuntu, which comes pre-installed with XFCE in place of Gnome.

    Of course, you can use preload in combination with XFCE, Gnome, or any other environment, for added performance.

  3. MeTaTuX says:

    Very good and detailed howto and well documented knowhow.

  4. Many thanks for your article!

    It provided the info I searched for: “Can preload help me?”

    And using a lighter DE is no option for me, since I really like my KDE 4 – I just want to get that reactiveness bonus.

    It would be very itneresting for me to know how performance changes, if I set preload to also keep smaller libs in ram.

  5. Arup says:

    XFCE is for low RAM systems with older graphic card. It puts less GUI load on systems. However today’s PCs with quad cores, 4GB RAM and dual GPU graphics can easily handle Linux’s low load GUI be it Gnome or KDE, programs like preload improve I/O which is the need of the day.

  6. eldarion says:

    how about the boot time benchmark? On my system, the preload deamon takes a lot of time to run (10-15 seconds).

  7. YAFU says:

    “Preload” seemed really interesting to me if the modules are preloaded in the cache as Linux does by default after an application is opened the first time, but experimenting with Preload I don’t get better results.
    Remember that whenever there is an article “Increase the speed…” “Speed up your …”, people make the mistake of measuring the times of the applications after they have been open at least once before in the same session, and the application always opens faster after the first time because that is how cached memory works by default in Linux. Only measuring the first time you open the application after rebooting the system is valid.

  8. debian user says:

    Try installing LXDE (Lightweight X11 Desktop Environment) – you’ll be surprised to see that it’s hell a lot nicer than XFCE and a whole lot lighter!!! So in this case you get even more boost.

  9. Graegos says:

    Would preload work well on a web server setup?

    • Lee says:

      @Graegos: NO, do not use preload in a web setup. With web servers, the goal is to NEVER load or swap — try to keep everything you need in memory. If you MUST call some external application regularly, then preload may help a little, but if you need it a lot, you’ve almost certainly mis-configured or mis-specified your server.

  10. Tom says:

    Seriously what the fricking fu**, that graph must be the biggest hoax i ever seen, 11 seconds for firefox and 4 seconds for gnome terminal? , my fricking asus 1215n netbook with a 1.8ghz atom cpu boots from grub into my desktop envirnoment in about 6.5 seconds, are you actually running this on a toaster?

Trackbacks/Pingbacks

  1. 10 cool Ubuntu applications to boost your productivity. « Seemanta’s Blog - 25. Mar, 2009

    [...] Link: http://www.techthrob.com/2009/03/02/drastically-speed-up-your-linux-system-with-preload/ [...]

  2. preload - Foros de CHW - 12. Oct, 2009

    [...] preload Tweak optimimizaciones en Linux [Tutorial] Optimizar y Acelerar Ubuntu —- Drastically Speed up your Linux System with Preload | Techthrob.com [...]

  3. Acelerar Ubuntu con Preload | Mostofreddy - 04. Feb, 2010

    [...] Drastically Speed up your Linux System with Preload Comparti! [...]

  4. Velecizzare il Sistema | bixbi.it - 18. Apr, 2010

    [...] Test riduzione tempi avvio [...]

  5. Ubuntu. Ускоряем систему с помощью preload | SAblog - 30. Sep, 2010

    [...] Собственно, вот график и данные, на которые случайно натолкнулся на этом блоге: [...]

  6. Daily Digest for October 20th « Fabian Rodriguez - 20. Oct, 2010

    [...] Drastically Speed up your Linux System with Preload | Techthrob.com [...]

  7. How can I improve overall system performance? Drija - 15. Nov, 2010

    [...] Preload (via Software Center or sudo apt-get install [...]

  8. Acceleriamo la nostra distro Linux con Preload - 26. Jan, 2011

    [...] [techthrob] Principali termini di ricerca per questo articolo:configurare preloadconfigurare preload [...]

  9. Boostez le démarrage d'Ubuntu 11.04 Natty Narwhall | WebDevOnLinux - 06. May, 2011

    [...] Preload va prendre une partie de la mémoire vive pour y pré-charger les applications que qui sont le plus souvent utilisé. Prelink reprend le même principe mais sur les librairies. sudo apt-get install preload prelink gksu gedit /etc/default/prelink [...]

Leave a Reply

Weekly Poll

What's the best Linux distribution for desktops?

View Results

Loading ... Loading ...

Search TechThrob

Advertisement