Ubuntu - a Speedup guide
Published October 5th, 2007 in LinuxUbuntu has been main player in Linux distro for a couple of years, and yet some might found it to be a little bit slow in a few aspects. Here i try to show some of guides that might give a boost to your Ubuntu systems. These tweaks will make your system faster and more responsive without a doubt. Read on to perform the tweaks and enjoy your faster system.
Speed up your file systems
Ubuntu Linux by default uses the EXT3 file system and there are 3 journaling methods for EXT3 system.
- Journal Data Writeback
- Journal Data Ordered
- Journal Data
On default installation Ubuntu chooses “journal data ordered” and In data=ordered mode, ext3 only officially journals metadata it logically groups metadata and data blocks into a single unit called a transaction. When it want to write the new metadata out to disk, the associated data blocks are written first. data=ordered mode effectively solves the corruption problem found in data=writeback mode and most other journaled filesystems, and it is done without requiring full data journaling. In general, data=ordered ext3 filesystems perform slightly slower than data=writeback filesystems, but slightly faster than the full data journaling counterparts. To speed it up we’re going to change it to data=writeback system.
Open your Grub boot menu.
sudo nano -w /boot/grub/menu.lst
Try Looking for the Defoptions and Altoptions and make them look like the entry below.
# defoptions=quiet splash rootflags=data=writeback# altoptions=(recovery mode) single rootflags=data=writeback
update your Grub since you have altered it.
sudo update-grub
edit the Fstab because it will be expecting these options.
sudo nano -w /etc/fstab
add the (data=writeback and noatime=0) flags to your hard drive. It might be a little confusing because of the new naming system. Look for the (,errors=remount-ro) and add it afterwards.
defaults,errors=remount-ro,data=writeback,noatime 0
Now you tell your system to use them both.
sudo tune2fs -o journal_data_writeback /dev/yourdrive
Concurrent Booting
Concurrent booting allows Ubuntu to take full advantage of dual-core processors, as well as processors that hyperthread or multithread.
These settings are located in your /etc/init.d/rc file.
sudo gedit /etc/init.d/rc
Look for CONCURRENCY=none and change it to:
CONCURRENCY=shell
Swapping
swappiness takes a value between 0 and 100 to change the balance between swapping applications and freeing cach. Kernel will always prefer to find inactive pages and swap them out. Default swappiness is 60 if a value of 0 gives could shrink the cache to a tiny fraction of RAM.
go to /etc/sysctl.conf file
sudo gedit /etc/sysctl.conf
and set the swappiness to
vm.swappiness=0
Speedup Broadband Internet
You have to open your /etc/sysctl.conf file back up again.
scroll to the bottom and just add these lines to it.
net.core.rmem_default = 524288
net.core.rmem_max = 524288
net.core.wmem_default = 524288
net.core.wmem_max = 524288
net.ipv4.tcp_wmem = 4096 87380 524288
net.ipv4.tcp_rmem = 4096 87380 524288
net.ipv4.tcp_mem = 524288 524288 524288
net.ipv4.tcp_rfc1337 = 1
net.ipv4.ip_no_pmtu_disc = 0net.ipv4.tcp_sack = 1
net.ipv4.tcp_fack = 1net.ipv4.tcp_window_scaling = 1
net.ipv4.tcp_timestamps = 1net.ipv4.tcp_ecn = 0
net.ipv4.route.flush = 1
or the sysctl to take effect.
sudo sysctl -p
and that’s all about it and from what I understand these tweaks will work with all forms of Linux. They are not Ubuntu specific.
15 Responses to “Ubuntu - a Speedup guide”
- 1 Pingback on Oct 6th, 2007 at 2:18 pm
- 2 Trackback on Nov 30th, 2007 at 6:00 pm
- 3 Trackback on Mar 8th, 2008 at 3:26 pm
Thanks for the tips.. I’m trying them out now.
I think you need to correct the speedup broadband access section as some of the settings are not on separate lines..
Cheers
Rax
Thanks for the comments.
Actually, telling the kernel to not swap hurts perfs, because it is no more allowed to make room (discarding unused pages) for increasing cache (so that IO are entirely in RAM and do not hit disk). For this to be really successful the noatime switch is required (without you have an RW access for each RO access, thus defeating the cache purposes) or have the latest kernel that mitigates the issue.
This noatime is not sufficiently promoted as _the_ real low hanging fruit for perfs!
I am skeptic on the propose network stack tunning for a broadband access: seems to me that it is more suited for Gb access. BTW do not shut down ECN, it “*will* hurt when routers overflows.
Hmm. On the ext3 journaling, I’m not sure trading a tiny bit of performance for a loss of reliability is a good trade. But at least it’s explained so that people can make their own decision.
The concurrent booting issue could be explained more, but seems pretty simple and reasonable.
The swap tweak is not at all clearly explained, and it doesn’t mention the (maybe better) possibility of changing to a value smaller than 60 but greater than 0.
Finally, the network changes at the end are not explained at all, and treated as magic incantations. This is not at all the way to run a system. Those may be good changes, or they may not be; without an explanation I have no idea what the tradeoffs are, and I suspect the author has no idea either.
There are reasons for the defaults, and consequences of changing from them, and it’s important to understand those reasons and consequences before making changes.
You should explain the disadvantages of data=writeback and swappiness=0 more thoroughly. Otherwise these tips are crap.
hi
as shown on this screen, you are missing line feeds on most of the broadband network lines:
net.core.rmem_default = 524288net.core.rmem_max = 524288
should be:
net.core.rmem_default = 524288
net.core.rmem_max = 524288
etc, etc.
dave
nice cover on speedup. pity that i should try to install ubuntu first!
CONCURRENCY=shell breaks HAL
https://bugs.launchpad.net/ubuntu/ source/hal/ bug/149881
Thanks for pointing out that concurrency breaks HAL. It continues to break HAL in the latest version of Hardy as of 1/23/08.
Do take note of the following please…..
Your broadband tweak prevents aMSN or KMESS from connecting with the server….
Editing Fstab to include defaults,errors=remount-ro,data=writeback,noatime 0 breaks disk & filesystem modules…
These are the experiences in Ubuntu Gusty.
I had the same problem with COncurrency and HAL. In a forum somewhere I found:
Do this before setting Concurrency=shell
sudo mv /etc/rc2.d/S12hal /etc/rc2.d/S13hal
sudo mv /etc/rc3.d/S12hal /etc/rc3.d/S13hal
sudo mv /etc/rc4.d/S12hal /etc/rc4.d/S13hal
sudo mv /etc/rc5.d/S12hal /etc/rc5.d/S13hal
and then do Concurrency=shell
The concurrency tweak works on my Hardy (Beta) machine without any breakage
Great !! Thank you very much for such tips.
Though not used the network tweaking…