So, your Linux box does not run as smoothly as your friend's cheap new notebook and you want to improve system performance? Then here are some tips, what can be done to increase responsiveness without having to buy a new CPU or other hardware:
- Do you have a 64 bit version of Linux installed? A lot of people make the mistake of going 64 just because they got a 64 bit CPU and think, this will automatically make their computer go faster. Actually, the opposite is true, as all binaries increase in size (approximately by 30%), resulting in longer loading time and more memory consumption. Unless you have more than 4GB of RAM installed, you do not really benefit from 64 bit operation systems.
- Keep track of the libraries, installed on your system. Desktop systems tend to clutter with software, that was once installed for testing purposes and then never used again. The problem with this is, that most software nowadays brings in a handful of shared libraries, which are added to the linker cache
/etc/ld.so.cache. Since that cache has always to be consulted, whenever a program is started, it should naturally be kept as small as possible.
- A curious and often overlooked fact on Linux systems is, that filesystems not only keep track on when a file was modified/created but also when it was accessed last time. That is, simply reading a file (e.g. starting a program) will result in disc write operations. This may make some sense for pathes like /tmp (to find abbandonned tmpfiles) and
/home,but it is utterly useless for the static portions of the filesystem. To disable accesstime logging, the respective filesystem can be mounted with the "noatime" option in
/homeand /tmp should live on partitions of their own (and have atime enabled).
- Swap partitions should always be located on the inner sectors of the harddisk. The tracks are shorter there, making seeking faster. Also, even if RAM is aplenty, swapspace should still be employed. Paging sleeping processes (e.g. CRON) out, frees up memory, that can then be used as a disk cache.
- Take a look at the output of
lsmod. Many desktop Linux distributions tend to load everything and the kitchen sink, in case it could be needed. Loading unnecessary kernel modules does not only slow down system booting, but also wastes RAM. Good things to check for are "parport", "ipv6", "apparmor", "irda", "psmouse"
- Check your locale settings. Often the locale settings are much more specific then the actual translation files. When a program starts up, it first tries to open a translation file, fitting the locale settings exactly and if that fails less specific alternatives are tried. This can lead to a lot of unnecessary disk IO, trying to open files, which are not there. The
stracetool can be used to find out, which files are opened during program startup:
strace /bin/ls 2>&1 | grep open
- Nowadays, setting up a network with Linux has become pretty convenient with tools like DHCP and Networkmanager. The downside of this however is, that DHCP slows down booting and Networkmanager consumes RAM. In a small LAN with stationary computers, setting up static IP addresses still is the better idea. In general, only programs should be running, that are actually used. Every kilobyte of RAM, that is not occupied by applications, can and will be used as disk cache. Having a large amount of RAM available for caching the filesystem is probably the most crucial thing to do in order to make a Desktop system faster.
- Uninstall Desktop software, that is not used. KDE and GNOME use .desktop files to store meta data on programs (e.g. localization, icons to use). While this is good for usability, it also produces a big performance hit. Especially try not to install both desktop environments, if you are only going to use one of them, as each system comes with a lot of dependencies.