Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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.

share|improve this question
38  
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
5  
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
5  
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
5  
Isn't "premature optimization the root of all evil"? (en.wikipedia.org/wiki/Program_optimization#Quotes) – Alejandro Sep 26 '10 at 2:11
2  
@Alejandro that quote assumes that you've done it as well as you could in the first place. – Thorbjørn Ravn Andersen May 16 '12 at 13:26

39 Answers 39

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

share|improve this answer
2  
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
8  
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
2  
@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

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.

share|improve this answer
    
I'm curious about what that tweak is supposed to accomplish? – FuzzyQ Jun 28 '12 at 12:41
    
a 15 year linux experienced guy told me that ...... – One Zero Jun 28 '12 at 13:58
4  
That doesn't answer the question and I didn't ask because I don't believe it. I wanted technical details. Thanks for your reply though. – FuzzyQ Jun 28 '12 at 14:28
    
gui load faster ..tested in redhat 5 – One Zero Jun 28 '12 at 15:13
    
This provides no information as to why we should follow your advice. Some context and benchmarks please. – Mateusz Konieczny Apr 16 at 6:16

Another good way to boost performance is to install CompizConfig Settings Manager, and disable animation effects, Fading Windows, and Window Decorations. Desktop wall and Expo are an option, too.

enter image description here

Also, use fast texture filter under OpenGL

enter image description here

share|improve this answer

I find strange that no one has mentioned anything about Unity. Unity is definitely something that one should consider removing if the system has to work faster (I shall not discuss whether Unity boost the user's productivity or not since this is quite subjective for many people).

I just got my hands on a virtual appliance created with VirtualBox with Ubuntu 14.04 with Unity in it. The default machine settings were 32MB memory for video, 2GB for RAM and 100% performance cap on the CPU (single one was chosen). Of course my CPU is a bad one (a 5-6 years old i3 from Intel with 1.66GHz and two cores). Because of the huge amount of RAM that was dedicated to the VM and the presence of only 3.8GB physical memory on my host I decided to reduce it to 512MB. It was unbelievable how sluggish the system was.

The recommended minimum system requirements given by Canonical are a joke. I cannot imagine anyone working at all under such conditions. Yes, these are minimum requirements but what is usually understood by that is that the system is still usable to a some non-suicidal degree with the exception of working with applications that require a lot more. The window manager should not put such a huge restriction on the hardware used (Windows Vista anyone?) especially since Canonical removed the Gnome 2 Classic option upon login (currently there are of course alternative, which are however not officially supported by Canonical). Appearance is something important especially if we follow one of the most profound rules in design and usability - "Form follows function". It should not however do what Unity does to the system resources. I strongly recommend starting from reducing the fancy-pancy garbage on your system and the first thing towards that is to replace Unity with for example LXDE, which looks great, offers a lot of room for customization (Unity and customization - pfffff...) and is a beast when it comes to small CPU usage and miniature memory footprint combined with the functionality it provides. My VM is currently flying after a single step of installing vanilla lxde:

$ sudo apt-get install lxde

A much more better way is to go for one of the variations of Ubuntu such as Lubuntu (LXDE) or Xubuntu (XFCE), which profit from the fact they share the same repositories, security updates, patches etc. with Ubuntu yet do not suck the life out of your machine. Installing another window manager on top of Ubuntu (which defaults to Unity) definitely helps a lot but Ubuntu's default installation also comes with a huge amount of resource-hungry services and applications most (all?) of which have more lightweight alternatives.

share|improve this answer
    
I find that Unity is actually very fast on some computers and very slow on others. I think this might just be a video card driver issue or something. I use Xubuntu, myself, though, as I find more utility in it, and Unity is slow on my current computer (which far exceeds Unity's requirements). – Shule May 21 '15 at 3:52

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

Note that since RAID 0 provides no fault tolerance or redundancy, the failure of one drive will cause the entire array to fail; as a result of having data striped across all disks, the failure will result in total data loss.

share|improve this answer

ADVANCED, DO NOT DO IF YOU DO NOT KNOW WHAT YOU ARE DOING

Compile your own kernel. http://www.overclock.net/a/how-to-configure-and-compile-a-custom-linux-kernel-for-ubuntu It may take quite some time, so do something else while you compile it. Once you're done, install the files and celebrate. Especially if you get huge speed improvements. :D

share|improve this answer
8  
Does anyone know if there are any remotely recent benchmarks that substantiate the idea that using a self-configured, self-built kernel is likely to produce significant speed improvements in current Ubuntu desktop systems? (If so, perhaps that information could be added to this answer.) – Eliah Kagan Jun 1 '12 at 22:43
    
Even if compiling your own kernel does not dramatically improve speed, it is a good Linux exercise that you should certainly do if you want to get more experienced with Linux (or, alternatively, if you are just super curious and want to find out what is happening under the hood). – InkBlend Oct 24 '12 at 21:38
    
For the time spent configuring your own kernel, the 0.2 seconds shaved off boot time and the <0.1% performance improvement under load is definitely worth the hassle </sarcasm> * numbers from my own experience. – Mark K Cowan Nov 5 '13 at 2:10

Use EXT4 file system

Adding noatime and nodiratime Edit fstab file

# nano /etc/fstab

Add discard to your ssd drives or partitions, after ext4

UUID=bef10b86-494d-41c6-aa46-af72cfba90fd / ext4 discard,noatime,nodiratime,errors=remount-ro 0 1

Disable hibernation Edit

# nano /usr/share/polkit-1/actions/org.freedesktop.upower.policy

Look for

<allow_active>yes</allow_active>

Change from “yes” to “no”, there are two, one for hibernation, and another one for suspend. If you have to disable them both, make sure to replace them both from yes to no.

<allow_active>no</allow_active>

Tmpfs

Edit fstab file

# nano /etc/fstab

Add the line to the end of fstab file

tmpfs /tmp tmpfs defaults,noatime,mode=1777 0 0

If logs aren’t important for you (laptop or desktop), you can also mount /var/log to

tmpfs. Add the line to the end of fstab file
tmpfs /var/log tmpfs defaults,noatime,mode=0755 0 0

Preload To install preload on Ubuntu, Linux Mint or debian based distributions

# apt-get update && apt-get install preload

To install preload on Fedora, Centos or Redhat based distributions

# yum install preload

Swap and Swapiness To change swappiness setting:

$ su -
# nano /etc/sysctl.conf

And add this line into sysctl.conf file.

vm.swappiness = 10

You can read more at nam huy linux blog How to tweak and optimize SSD for Ubuntu, Linux Mint http://namhuy.net/1563/how-to-tweak-and-optimize-ssd-for-ubuntu-linux-mint.html

share|improve this answer
    
Welcome to Ask Ubuntu. A few remarks. You don't explain how to use EXT4 or how to check if you are already using it. The fstab thing only applies if you are running a SSD. Please explain this before telling what to change. How will disabling hibernation improve performance? yum should be apt-get I guess. – MadMike Nov 5 '13 at 7:21

The other answers say a lot, already. However, make sure you're using the optimal video card driver for your system. Using the wrong one can really slow it down. The best one for my system on Xubuntu 15.04 is the legacy Nvidia one. The newest version and the open source one are either slower with certain applications (such as Tkinter apps and SciTE), or they crash my computer.

I might recommend not using lightdm for locking your screen and such, because unless they've fixed it in this new release, it's a lot slower going to sleep and waking up than what they used to use. That might seem program-specific, but it really does go a long way toward a faster computer, practically speaking, in my opinion.

I would recommend looking at hardware instead of software tweaks, after you've done all the software tweaks you can handle. You might consider a solid state hard drive.

You also might consider using a different window manager.

share|improve this answer

One desktop that I would definitely recommend over Unity, or even XFCE, is i3. There's a website for it here. I have seen major improvements in performance, even on my netbook with 1GB of RAM.

share|improve this answer

protected by Community Dec 23 '15 at 12:44

Thank you for your interest in this question. Because it has attracted low-quality or spam answers that had to be removed, posting an answer now requires 10 reputation on this site (the association bonus does not count).

Would you like to answer one of these unanswered questions instead?

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