Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

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

37 Answers 37

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)

share|improve this answer

You may uninstall some applets you don't use, turn off auto-run command for some programs (or delay their auto-start). Don't forget about pre-load sudo apt-get install preload. This will greatly speed up starting up software you constantly use.

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

RAID for everything!

(I'm experimenting with a lot of tips out there on performance, as the task is teaching me a lot of stuff, and as per the request in the original question, I'll make a separate post for each).

If you've more than one drive, you can set up RAID. The pros and cons of different RAID levels is well documented all over the place, so I won't go into it. Personally I have two drives so I'm really picking between 0 and 1 (though mdadm can do a form of 5 on just two drives, but I haven't tried it). Since there are things that can go wrong with a computer - especially a laptop that has a greater risk of physical mishap - that no RAID level can save you from, and you therefore need a strategy for dealing with risks that doesn't depend on RAID to save your bacon, (it won't save you if you experiment with a performance tweak you read on the internet and it makes things unbootable, for example) I decided to go with RAID 0.

The easiest way to do this for the whole system is to install from the alternate ISO rather than the desktop installer that lets you boot straight off the CD/DVD/USB into Ubuntu.

Select "Manual" paritioning. Divide up your disks so that you've partitions you will use on each disk. E.g. if you've two disks and decided to set aside 100GB for /home then you would set aside 50GB on each if using RAID 0, 100GB on each if using RAID 1.

Select "Configure Software Raid". Select "Create RAID Volume" (or something close to that, I'm not going to boot into the installer to check the wording). Pick those partitions you want in your first RAID volume, the type of RAID, and create it. Repeat until you have all of your volumes set up. (You don't need to put your swap on RAID, just give the two or more swap partitions the same priority in fstab and they'll be used together without RAID).

The assign filesystems and what's mounted where as you would with any installation and away you go.

A lot of stuff out there says you can only have /boot on a RAID 1 or non-RAID partition. I've had it on RAID 0 without any problems, which may be a matter of Ubuntu moves on, linux moves on, or BIOS moves on (and if its the last then your BIOS may not be okay with /boot on RAID 0).

The installer will install grub on all your drives. This gives one the benefit that if something stops booting on your "first" drive stops working, you can go into the boot menu and boot off the second.

hdparm does indeed see things has having been doubled in speed for me, and there's certainly a perceptible increase in speed on a lot of things too. I found in experimenting that the first part of booting (after the grub menu, when you've blank purple) seems to be slower, the second part to be faster (rarely time to show the animation now) and application use is faster - the greatest increase in performance of any of the tips I've tried so far.

share|improve this answer

This solution worked for me.

I didn't have to reinstall the whole system again. I cloned my current machine (just in case) and set the configuration as the blog said and it does work. I don't think it is perfect but at least tolerable. The only thing I couldn't set is turn off the dynamic storage for a static one. Any ideas?

share|improve this answer

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

edit /etc/sysctl.conf with the following

vm.swappiness=5 net.ipv6.conf.all.disable_ipv6 = 1     
net.ipv6.conf.default.disable_ipv6 = 1        
net.ipv6.conf.lo.disable_ipv6 = 1     
net.core.rmem_max = 16777216     
net.core.wmem_max = 16777216     
net.ipv4.tcp_rmem = 4096 87380 16777216     
net.ipv4.tcp_wmem = 4096 65536 16777216      
net.ipv4.tcp_no_metrics_save = 1     
net.ipv4.tcp_moderate_rcvbuf = 1      
net.core.netdev_max_backlog = 2500     
net.core.netdev_max_backlog = 30000    
net.ipv4.tcp_timestamps = 0     
net.ipv4.tcp_window_scaling = 1     
net.ipv4.tcp_sack = 1 net.ipv4.tcp_fack = 1

Add the following line above exit 0 in rc.local:

renice -n -5 $(pidof X)  

Install preload DO NOT install clamav. This causes a memory leak in nautilus that makes python processe peak at 2.2 gb, as well as nautilus. change the following in fstab

noatime,nodiratime,data=writeback,errors=remount-ro

finally install namebench and check your dns servers.

Shut off dns caching. No joke, take out pdnsd and any other dns cachers. They won't beat google or openDNS times on getting responses.

share|improve this answer
6  
Downvote: Lots of "magical" recipes with no explanation of what they do or why they work. This is not a good answer to me. –  Javier Rivera Feb 14 '13 at 21:18

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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