What are your tips for improving overall system performance on ubuntu? Inspired by this question I realized that some default settings may be rather conservative on Ubuntu and that it's possible to tweak it with little or no risk if you wish to make it faster.
This is not meant to be application specific (e.g. make firefox load pages faster), but system wide.
Preferably 1 tip per answer, with enough detail for people to implement it.
A couple of mine would be:
- Install Preload (via Software Center or
sudo apt-get install preload
); - Change Swappiness value - "which controls the degree to which the kernel prefers to swap when it tries to free memory";
What are yours?
PS: Since this is not intended to have a unique answer but rather, several useful tips, I'm making this community wiki out-of-the-box.
If you are "the average Joe", then just don't do anything. Don't fiddle with programs or settings which you don't understand. Don't follow tips posted on the Internet how to improve the performance of your system by compiling some software yourself or by installing a selfmade kernel.
Some of those tips may give you minor performance improvements indeed, but some of them will also give you a real headache, if you changed the wrong setting, disabled the wrong service, installed the wrong driver etc.
Therefore just be happy about your nicely running system. And BTW: Why would you need those 5 percent performance improvements? It will not lead to typing your office documents faster or editing your holiday photos in half the time.
And just to be clear: If you are not the average Joe, but a developer/hardcore gamer/... needing any cycle you can get, you are not the target of this comment...
Disable automatic startup of any services that are not needed (or even remove the package completely).
A lot of packages start up services automatically. These services then use memory and CPU even they are hardly ever used. It is better in this case, to stop those services, or take them out of autostart, and start them up only if they are needed.
To remove applications from starting up on 10.04,go to System > Preferences > Startup Applications (may be slightly different on other versions)
On 12.04, you can go select the startup applications by clicking on the Dash Icon. Then, type startup and select "startup applications".
And just unmark the apps you don't need. But be sure about it, don't just remove apps you don't know. If you are not sure about one, leave it that way. A google search or new question here about specific programs will help.
Tushar Neupaney gives this advices here:
1. Use lighter applications (Replace your default applications with them)
2. Decrease Swappiness
sudo vim /etc/sysctl.conf
Edit: vm.swappiness=10
3. For dual cores (Use Concurrency)sudo vim /etc/init.d/rc
Edit: CONCURRENCY=shell
shell option is now obsolete. Default value is makefile and shell is by 2010-05-14 an alias for makefile.
4. Clean up apt cache at /var/cache/apt/archives and unneccessary apt-sources list in /etc/apt/sources.list
sudo apt-get autoclean
5. Install BUM (Boot Up manager)
sudo apt-get install bum
Remove unnecessary applications and services from startup
6. Remove some unnecessary TTY’s
sudo vim /etc/default/console-setup
Edit: ACTIVE_CONSOLES=”/dev/tty[1-3]“
Note: goto
/etc/init/
and change the tty’s files that you DO NOT want. Edit them and comment lines starting with “start on runlevel”. So, in this case, you’ll comment the start line in "tty4.conf" to "tty6.conf" files.7. Install Prelinksudo apt-get install prelink
sudo vim /etc/default/prelink
Edit: PRELINKING=Yes
sudo /etc/cron.daily/prelink
Actually, Prelink is useless since Feisty Fawn (because Ubuntu uses a very effective runtime linker now). In addition, it's intrusive - it directly modifies the executables and ultimately can break them. DO NOT do it.
8. Install Preload
sudo apt-get install preload
9. Get rid of kinit if you don’t use hibernate and sleep functions.
sudo vim /etc/initramfs-tools/conf.d/resume
Edit: Comment (Put # in front of) RESUME=XXXX…………………….
Decrease your boot loader menu timeout
Sounds trivial, but I found the default 10 seconds in Ubuntu is too long for my tastes. Say my screen takes a bit to auto-adjust the res, I see the counter reads 8 seconds at first sight.
I would edit the timeout to 3 seconds, giving me a second to see the boot menu (accounting for the time my screen adjusts to the res). Plenty of time, as pressing the arrow keys to select another item stops the counter.
Grub (before 9.10 Karmic)
Find and edit the "TIMEOUT" line
Grub 2 (new installs of 9.10 Karmic and after)
Find and edit the "GRUB_TIMEOUT" line, and run
sudo update-grub
If you are short of RAM, use zramswap or
zram-config
from Ubuntu repos. It's virtual swap that compresses unused RAM contents instead of putting them to disk (which usually freezes the system after you hit the RAM barrier). I experience little to no performance loss with it instead of system freezing every time I run out of RAM.This works only for Natty and up (because you'll need kernel 2.6.37.1 or newer). For older systems you can use compcache, but you'll have to set it up manually.
For those who never hit the RAM limit it gives some speed boost on HDD systems anyway, but you'd better decrease swappiness to achieve the same effect.
SSD users: most likely you won't experience any speed boost, but zramswap can reduce SSD wear quite a lot.
I experienced an overall performance boost after I added the "noatime" option to my filesystems (ext4 and reiserfs).
I cannot provide speed tests, but I invite you to try it and see for yourself.
Useful resource at Ubuntu Forum: Saving hard drive with noatime in fstab.
Change your Mechanical Disk for a SSD
Solid State Drives are much faster and seems to be the most bottleneck in almost every computer nowadays.
I, for one, have experienced decrease in boot time from ~15 seconds to ~3 seconds, and great decrease in first start apps (Firefox, for example, from ~5 seconds to less than a second).
Want some benchmark? Here is one.
I'm not sure if my answer would qualify, because Ubuntu usually means GNOME and Ubuntu variations that use lighther alternatives have slightly different names, like Xubuntu.
Getting rid of GNOME is the first thing that I usually suggest. If you are happy with something lightweight like fluxbox, do it.
Set
vm.swappiness=10
in/etc/sysctl.conf
. I get a noticeable speed improvement when I fill memory. Since I use Eclipse most of the time, physical memory can become a sparse commodity.EDIT:
From the Ubuntu Swap FAQ:
"The default setting in Ubuntu is swappiness=60. Reducing the default value of swappiness will probably improve overall performance for a typical Ubuntu desktop installation. A value of swappiness=10 is recommended, but feel free to experiment. Note: Ubuntu server installations have different performance requirements to desktop systems, and the default value of 60 is likely more suitable."
The FAQ is pretty complete about explaining what swap is, how it is used and how to change it. Recommended reading for anyone thinking of tinkering with swappiness or the size of swap file on disk.
As silly as it sounds, always update your system!