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.

link|improve this question
12  
+1 for mentioning preload. – Erigami Aug 13 '10 at 17:41
12  
It would be a good idea to mention how effective your tip is: how much of an improvement did you notice, or even better, measure? – Gilles Aug 13 '10 at 17:47
4  
I have not found any evidence that changing the swappiness has any positive effect. It might give a temporary feeling of performance increase, that seems to subside quite fast. I have not seen any concrete evidence in form of benchmarks that would proof the effectiveness of changing the swapiness parameter – txwikinger Aug 14 '10 at 14:27
3  
I doubt it has any noticeable performance impact. The ttys used hardly any memory, nor would there be any significant cpu usage. – txwikinger Aug 16 '10 at 14:37
2  
Isn't "premature optimization the root of all evil"? (en.wikipedia.org/wiki/Program_optimization#Quotes) – Alejandro Sep 26 '10 at 2:11
show 4 more comments
feedback

22 Answers

Disable automatic startup of any services that are not needed (or even remove the package completely).

A lot of packages startup 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 startup go to System > Preferences > Startup Applications (on 10.04, may be slightly different on other versions)


alt text

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.

link|improve this answer
2  
Good one! simple and effective. I personally disable bluetooth related stuff, since my notebook doesn't have it. – Decio Lira Aug 13 '10 at 17:14
2  
Could you explain / add a link explaining how to view and disable/enable services under Ubuntu. – Skizz Aug 20 '10 at 23:16
feedback

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...

link|improve this answer
13  
Tweaking settings and compiling your own kernel and software is a great way to learn. I think it should be encouraged, as long as people know that when they break things badly, they may need to re-install their OS. – Nerdfest Aug 21 '10 at 14:09
5  
Only people that really want to understand how the kernel works should consider compiling your own kernel. For most people, they should even know a "kernel" exists. Stick with a stock kernel and you can take advantage of the regular software updates. – Brad Figg Aug 22 '10 at 20:11
@bananeweizen: I was about to yell at you something like "who do you think you are?" or some other kindergarten-ish insult: luckily I read more than once your answer...if I could I'd upvote it hundreds times. – dag729 Aug 22 '10 at 20:49
1  
@Brad, ah how the times have changed :) When I started with Linux we had to compile our own kernel since it was before dynamic modules were implemented. I don't miss it though! – Thorbjørn Ravn Andersen Aug 26 '10 at 5:42
6  
@ixtmixilix Did you even read (or understand) my answer? I explicitly answered for the average people. To me it looks like you where just fishing for the commentators badge. Shame on you. – Bananeweizen Oct 11 '10 at 16:56
show 4 more comments
feedback

Tushar Neupaney gives this advices here:

1) Use lighter applications (Replace your default applications with them)

  • Gedit >> Mousepad
  • Picture viewer (EOG …) >> Gpicview
  • Network Manager >> Wicd
  • Evince >> epdfview

2) Increase 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 unneccessary applications and services from startup

6) Remove some unneccessary TTY’s

$ sudo vim /etc/default/console-setup  

Edit: ACTIVE_CONSOLES=”/dev/tty[1-3]“

Note: goto /etc/event.d/ and change the tty’s files that you DONOT want. Edit them and comment lines starting with “start on runlevel”. So, in this case, you’ll comment the start line in tty4..tty6 files.

7) Install Prelink

$ sudo 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…………………….

[Disclaimer] Administer the following at your own risk.

link|improve this answer
2  
It's a mystery to me why answers like this one don't get up-rated. – ixtmixilix Oct 11 '10 at 0:40
Wow, some really good advice here. – Robert Massaioli Oct 12 '10 at 4:39
10  
This provides no information as to why we should follow your advice. Some context and benchmarks please. – The Pixel Developer Oct 15 '10 at 2:42
2  
I was trying number 3 and the comments above the line to change listed the valid options and 'shell' was not one of them. Is this answer old? Did the comment not tell me all the options? – John Jun 6 '11 at 18:26
1  
I tried number 3 as well despite that "shell" option was not mentioned as valid one. After edit booting took twice longer than when concurrency was set to "none". So I went back to orginal setting. – Wojciech Sep 1 '11 at 21:09
show 4 more comments
feedback

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)

sudoedit /boot/grub/menu.lst

Find and edit the "TIMEOUT" line

Grub 2 (new installs of 9.10 Karmic and after)

sudoedit /etc/default/grub

Find and edit the "GRUB_TIMEOUT" line, and run sudo update-grub

link|improve this answer
feedback

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.

link|improve this answer
Think I will give this option a spin. – Wesley Aug 26 '10 at 12:46
1  
isn't relatime already the default in ubuntu? – ImaginaryRobots Sep 27 '10 at 19:16
@ImaginaryRobots: "I experienced an overall performance boost after I added the noatime option to my filesystems (ext4 and reiserfs)." -- Do you mean "relatime"? -- Nope, I meant "noatime" :D – dag729 Sep 30 '10 at 14:37
This might break some email software that rely on this feature and a few backup tools. But for the casual user this should be OK as neither Thunderbird, nor Evolution would be affected. Though on Ubuntu, switching from relatime (default) to noatime won't bring much improvements. See lwn.net/Articles/244829 how relatime works and you will understand that it will already dramatically decreased the number of last access time updates. – Huygens Mar 28 at 10:51
feedback

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.

link|improve this answer
2  
@Erigami: +1 for mentioning something that actually made a difference to you. – Gilles Aug 13 '10 at 18:04
2  
@DecioLira: No. It pushes the apps I'm not currently using onto disk, meaning that the one I'm currently in has access to more physical memory. – Erigami Aug 13 '10 at 19:40
2  
Do you have any hardcore number that show the difference and in which situation and makes what kind of difference? – txwikinger Aug 13 '10 at 20:02
1  
@txwikinger Nope. With lots of apps running it feels faster than a swappiness of 0 or 10. – Erigami Aug 13 '10 at 21:04
2  
@Erigami: I played around with swappiness for some time. And at the beginning it felt like it was faster, but with time it all seemed the same. Some real measurements would really be interesting. – txwikinger Aug 13 '10 at 21:12
show 2 more comments
feedback

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.

link|improve this answer
I know that Archlinux is not Ubuntu, but I saw an exaggerated performance boost when I installed Ratpoison on my Archlinux box (yes, way too minimal for someone, but still a nitro boost for your box) – dag729 Aug 22 '10 at 20:39
+1 for mentioning an alternative WM – ixtmixilix Oct 11 '10 at 0:41
1  
Agreed, try XMonad, it's awesome. – Robert Massaioli Oct 12 '10 at 4:37
+1. Or install Ubuntu, but switch to xfce after the install. – David Oneill Dec 16 '10 at 22:44
1  
@Robert Massaioli: really neat joke! – dag729 Mar 3 '11 at 23:47
show 1 more comment
feedback

Close applications that are not used all the time.

A lot of standard applications use a lot of memory and often also CPU while they are running in the background. Webbrowser, email clients etc are very inefficient in memory usage and the javascripts embedded often use CPU time with no benefit to the user.

Just by only running the applications that are used currently, the system will be a lot faster. Also, stopping applications is the only way of freeing memory lost in memory leaks.

The startup of the application on a fast running system is often less than switching windows on an overloaded and slow system.

link|improve this answer
3  
Yea but that kind of goes without saying. – Dmitriy Likhten Aug 13 '10 at 19:41
My CPU's fan was turning on a lot when I left Firefox open. I stopped using FF and switched to Chrome. I know that isn't a direct performance improvement, but I presume the CPU is being hogged less so other apps could use it more. – Erigami Aug 13 '10 at 19:42
1  
@Dmitriy Likhten: How many people have an e-mail client run in the background? We should give them a lightweight applet instead that notifies of new e-mail, and the e-mail client is only opened when the e-mails are read. – txwikinger Aug 13 '10 at 20:04
For an e-mail client, I suspect it would be counterproductive. When it's only waiting for new mail, most of its memory can be swapped. And loading back from swap might be faster than loading all the separate file that the mail client is using. OTOH, this tip is highly relevant for a web browser, where as you mention even background tabs/windows are often using a little CPU time and can't be swapped because of some animated pictures or javascript on a timer. – Gilles Aug 14 '10 at 8:38
1  
Well.. the problem is that swapping is unfortunately often slower than using no swap but enough memory available to start the application in its entirety. While swapping seems to work well on servers, on desktops its seems to do more damage than helping in my experience (I also have to say that this is one of the deterioration of the Linux kernel in the last 5 or so years. Swapping used to work lots better). – txwikinger Aug 14 '10 at 14:25
feedback

On one Ubuntu machine I have, I found that setting desktop effects to none (disabling all the graphical effects) made a huge UI speed improvement.

link|improve this answer
3  
This setting can go both ways. Sometimes allowing the GPU to do the work instead will free up the CPU and RAM and improve overall system performance. – ændrük Sep 3 '10 at 20:32
Great -- how do you make that adjustment?? – ixtmixilix Oct 11 '10 at 0:44
@ixtmixilix: Right click on the desktop and select the display option (it's the bottom one IIRC - I'm at work and have to use SomeOtherOS). – Skizz Oct 15 '10 at 11:11
thanks... your comment may mean I don't switch back to Debian, which was light years faster due to being less flashy... for the record (if other people want to try it) you get there under the 'change desktop background' menu... (?)... sorry but calling it that reminds me a bit of SomeOtherOS – ixtmixilix Oct 15 '10 at 21:22
feedback

Buy as much memory as you can afford and the machine can hold.

link|improve this answer
3  
ørn, the idea behind this question is learn a little more about the system, and how to tune for people who are interested about it. Just buying a new machine/parts is an obvious answer that don't teach anything. – Decio Lira Aug 25 '10 at 22:42
5  
Then mention that in the question. Buying more RAM is probably the simplest and most efficient way to speed the system up at all (since Linux uses the unused memory as disk cache). – Thorbjørn Ravn Andersen Aug 26 '10 at 5:38
feedback

As silly as it sounds, always update your system!

link|improve this answer
Yes. I notice improvements immediately after doing so. – ixtmixilix Oct 11 '10 at 0:41
feedback

The following is for experts only. As the name implies, it can and will eat your data, even if you are careful.

eatmydata is a drop in package that will turn off fsync. Fsync is a system operation that ensures that your data is written to disk before continuing. Generally you want this, as it makes recovering from power outages and failures easier, faster, and less data lossy. It comes at a price though; anything calling fsycn will have to wait it's turn in line, rather than simply delivering data to the kernel to write at some later date. And in some, perhaps even many filesystems, fsync will write out all data, not just the stuff you're interested in protecting.

There are some specific situations where fsync isn't worth the cost. Imagine you have a server that number crunches a bunch of data. Rather than pointing this at a live database, it might be faster to dump into a consistent local database, install eatmydata to turn off fsync, and let that go. This can still crash and lose data, but since it's not the only copy of anything, you can just restart the process from scratch. Or, for example, Ubuntu's build servers, where all we care about is the final package produced. Or, on the desktop side, if a program (like Firefox) is syncing so much it's slowing the entire system down. Just be prepared to lose all data associated with using this, or face dire consequences.

link|improve this answer
feedback

If you are short of RAM, use zramswap. 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.

link|improve this answer
1  
Seems like a very useful app to have! – Decio Lira Oct 19 '11 at 0:31
feedback

***Each of the kernel parameters are in a field = value format. For example, the parameter kernel.threads-max = 16379 sets the maximum number of concurrent processes to 16,379. This is smaller than the maximum number of unique PIDs (65,536). Lowering the number of PIDs can improve performance on systems with slow CPUs or little RAM since it reduces the number of simultaneous tasks. On high-performance computers with dual processors, this value can be large. As an example, my 350 MHz iMac is set to 2,048, my dual-processor 200 MHz PC is set to 1024, and my 2.8 GHz dual processor PC is set to 16,379.

Tip: The kernel configures the default number of threads based on the available resources. Installing the same Ubuntu version on different hardware may set a different value. If you need an identical system (for testing, critical deployment, or sensitive compatibility), be sure to explicitly set this value.

There are two ways to adjust the kernel parameters. First, you can do it on the command line. For example, sudo sysctl -w kernel.threads-max=16000. This change takes effect immediately but is not permanent; if you reboot, this change will be lost. The other way to make a kernel change is to add the parameter to the /etc/sysctl.conf file. Adding the line kernel.threads-max=16000 will make the change take effect on the next reboot. Usually when tuning, you first use sysctl –w. If you like the change, then you can add it to /etc/sysctl.conf. Using sysctl –w first allows you to test modifications. In the event that everything breaks, you can always reboot to recover before committing the changes to /etc/sysctl.conf.

***I learned that from this extreme tech article.

link|improve this answer
1  
How is lowering the total number of threads supposed to make a difference to performance? It's rarely reached on most systems anyway. It could be useful on a server whose main job is to serve http requests, but what evidence do you have that the default setting is not the best? – Gilles Aug 13 '10 at 18:02
@gilles I mentioned a tip, I thought might be useful. Regardless if a computer reaches max number of threads, if it is slow it would be beneficial to lower the maximum number of threads. Also no one ever stated that this couldn't be a computer serving http requests. – myusuf3 Aug 13 '10 at 18:44
3  
There are plenty of people who've found some setting and decided to tweak it, and then posted it to the web with some dodgy explanation of why it would improve performance, without ever checking whether it did make a difference. Sometimes someone bothers to check, and often they discover that the default setting is there for a reason, namely that the original author did test and chose a reasonable default. So my question still stands: can you cite a benchmark that shows that (at least in some circumstances) the default setting is not appropriate? – Gilles Aug 13 '10 at 19:33
1  
@gilles default setting are default for a reason appealing to the most people, those who wish not to tweak can go on with their lives. Although If your among the sticklers (and i am sure you are) then your more than welcome to benchmark it. let me know how it goes :) – myusuf3 Aug 14 '10 at 2:48
feedback

If you want to have a look at what services are started after booting on Ubuntu 10.04 run "jobs-admin". You can get it from this ppa https://launchpad.net/~jpeddicord/+archive/jobs and it will be available on Maverick.

link|improve this answer
feedback

If we are talking about getting from BIOS to internet connectivity i can recommend setting up network without using NetworkManager, personally I've done this because i have a very sluggish DHCP server and NetworkManager doesn't start probing for network until i've logged in.

link|improve this answer
Boot time is an important performance aspect. how one goes about setting up network without NetworkManager? – Decio Lira Aug 13 '10 at 23:11
Disable "Connect automaticly" in Networkmanager and take a look at this ubuntu.stackexchange.com/questions/1277/… you can also look at man interfaces – Source Lab Aug 13 '10 at 23:22
I removed NetworkManager and its Gnome friend once and for all... – dag729 Aug 22 '10 at 20:35
Me to, doesnt really need in anyways, you can do all the same things from the terminal any way.. – Source Lab Aug 22 '10 at 22:09
There is an alternative to NetworkManager called Wicd I used to use to get rid of the password on boot and so that it would start the network before the desktop: wicd.sourceforge.net – Phil Hannent Sep 27 '10 at 8:18
feedback

Put your /tmp directory into a ram disk

http://superuser.com/questions/175861/ramdisk-ubuntu-10-04

link|improve this answer
feedback

Tuning ext4 for maximum smoke

Enable writeback mode. This mode will typically provide the best ext4 performance. tune2fs -o journal_data_writeback /dev/sdXX

Check fs options

dumpe2fs /dev/sdXX |more

Even more smoke

to squeeze even more performance add fstab opions: data=writeback,noatime,nodiratime i.e: edit your /etc/fstab find the UUID for your drives and add/replace existing options

/dev/sdXX /opt ext4 defaults,data=writeback,noatime,nodiratime 0 0

ensure you have used tune2fs to turn on writeback mode BEFORE you edit your fstab file and BEFORE you reboot.....I say BEFORE because I rebooted after I altered my fstab but before I turned on writeback mode and borked my boot....nothing lost but I had to use a live CD to gain access and change my fstab.... safer if you enable on a non boot drive to test first ....

massive improvement in speed in both boot and shutdown and day to day use

You can also turn off Journal mode that will give an added boost, for added safety make sure you have a UPS connected and working because with these features turned off your data isn't as safe, having said that my system doesn't have a UPS and it's power has been interrupted at least three times and I've suffered no data loss, but your mileage may vary

link|improve this answer
may be its good to config these setting on laptop , no power down..... good configs i will try it – One Zero Mar 26 at 15:59
feedback

use lighter programs instead of default: gnumeric instead of oo calc, abiword instead of oo write and so on

link|improve this answer
feedback

Try the ck patchset: https://launchpad.net/~chogydan/+archive/ppa

It is a kernel with experimental patches to improve desktop performance.

link|improve this answer
feedback

If you edit video files, set up a stripped RAID 0 configuration for your video files. I noticed significant improvement in the smoothness of video editing after I did this.

http://en.wikipedia.org/wiki/Standard_RAID_levels#RAID_0

Of course you will need a minimum to two hard drives to do this, and it's easier if they are separate from the drive the OS is on (If you only have two hard drives, as I did, you can create a mirrored, RAID 1, boot partition and then a RAID 0 partition for everything else)

link|improve this answer
feedback

                              Using localhost as the the host name

This method could improve the speed of start the application .

                                                                    nano / etc / hosts

127.0.0.1          localhost Ubuntu
127.0.1.1          Ubuntu

In the end of the first line, add the host name, which is the name of the second line.

link|improve this answer
feedback

Your Answer

 
or
required, but never shown

Not the answer you're looking for? Browse other questions tagged or ask your own question.