HOWTO Speedup your Debian GNU/Linux

This article was first written in January 2005 for the BeezNest technical
website (http://glasnost.beeznest.org/articles/195).
Warning: This article is still work in progress. You have to keep in mind that speed is somewhat relative. It is often just a question of personal feeling, especially for a desktop machine. There are many ways to speed your Linux installation. Here, we will show how to do it on Debian Sarge+, but most tips should also improve performances on other distributions. We will focus on a desktop install. Speeding up a server is also possible and most of the time the same tips apply. Some tips can also be found here: Debian Wiki LinuxSpeedup and here: Optimizing Desktop Performance. There are many aspects to the slowness:
  • Time to boot (only important if you need to often reboot or halt your machine)
  • Time to start an application
  • Speed of the applications (while running)
  • Speed of the network (even some application not especially network-oriented may suffer from a slow network)
Lets's address each one at a time:

Time to boot

Time to start an application

  • Prelink the system
  • Reduce RAM usage or add physical RAM
If some swapping is involved, time to start an application is increased. So try to stop as many programs and services you can, or add physical RAM (which is often the cheapest solution, by far). To stop as many programs and services, many things are possible [...] If RAM is available, it will automatically be used as disk cache by Linux. So, more you have free, less the following is important.
  • Improve the disks/filesystems access speed
    • Use SCSI or SATA disks
    • On IDE disks, use "hdparm"
    • With UNIX filesystem types (ext2, ext3, reiserfs, ...) the access to the filesystem slows down when nearly full. Try to free some disk space if you feel this. There is no need for defragmentation, except on very busy filesystems (like many, many small files written and deleted all the time for months. An e-mail or newsgroup server for example).
    • Change the disks to newer, faster ones
    • Use RAID-1 (hardware or software) to span disk access to several disks/controllers
    • Use the best-suited filesystem for your usage. Some filesystem are reported being faster or simply more appropriate to some usages, try to use that.
  • Application poorly-written: Some applications do a lot of disk access without reason, you can trace that with the strace utility by starting your application "under" strace.
The interesting options of strace here are: "-e trace=file", "-c", "-T". See manpage for more info.
  • Quickstarters: Some (mainly graphical) applications provide a quickstarter, or quicklauncher which preloads some libraries and/or executables for loading it much faster on consequent uses. Ex: OpenOffice.org and Mozilla.

Speed of the applications you use

  • Use an optimized kernel for your machine (Debian packaged, or even home-made which involves rebuilding your kernel)
  • Use optimized binaries or libraries, when several are available, or there are some improving an existing library.
Using package libc6-i686 [1] [2] comes immediately to mind.
  • Prefer native applications (try to avoid Java/Python/Mono/... applications when possible)
  • Give more or less priority to some programs by renicing them manually or automatically with AND

Speed of the network

  • Name resolution
  • Bandwidth
  • Round-trip

Architecture-specific remarks

  • use libc6-sparcv9(UltraSparc II) or libc6-sparcv9b(UltraSparc III) instead of libc6-i686
  • prelink does not work correctly on Sparc and Alpha yet

[1] this packages includes optimizations for any recent CPU and the Native POSIX Thread Library (NPTL) support [2] Be careful though, it can cause problems with some proprietary software, like some JDK. You would immediately notice though, and removing the package is enough to make it work again, may that be the case