Ubuntu speed-up tips
OUT of the box, Ubuntu Linux runs very decently on my 1.5GHz Pentium 4 PC with 512MB of RAM. But when I added the Beryl window manager, with all its cool 3D and animated effects, I experienced a slight but noticeable slowdown. This is no surprise, since all that eye candy uses up processing cycles and memory.
I wanted to bring some snap back to my system, so I scoured the Web for Ubuntu speed-ups. The trips I list here are not originally mine but come from a variety of sources that my search produced.
While I found many such tips and tested most of them (some seemed to dangerous to try), I’ve included only those that I felt clearly improved my PC’s performance. The tips aren’t all specific to Ubuntu, and may work on other distributions as well, but I haven’t tried them out on any other flavor of Linux. Also, note that some of them are specific to Dapper, and may no longer apply to the Feisty release.
Now let’s roll up our sleeves and get to work on tuning our Ubuntu PC for performance.
Tip No. 1: Use that memory!
In an excellent three-part article, Tom Adelstein observes that for the longest time, Linux was used as a workstation or server rather than as a desktop operating system. Thus, the default settings that come with most distributions are not optimized for desktop PC systems.
One bottleneck, Adelstein says, is the tendency of Linux to use a swap file on the hard disk instead of RAM. Since the hard disk is 100 times slower than internal memory, this can slow things down considerably.
The tendency of Linux to go to the swap file is controlled by a variable called “swappiness” and the higher the number, the greater the tendency to go to the disk. To find out what the swappiness is on your machine, type the following in a terminal window (if you want to make sure you don’t make any typing errors, you can copy the line and paste it into the terminal window with Ctrl-Shift-V) :
sudo cat /proc/sys/vm/swappiness
Type your password and wait for the terminal program to come back with a number. If you have the default Ubuntu setting, it will say “60.” We want to lower that to 10 by typing this in the terminal window:
sudo sysctl -w vm.swappiness=10
To make sure the system always uses a swappiness of 10 on every boot, we’ll need to edit the sysctl.conf file in the etc directory. To do this, type:
sudo gedit /etc/sysctl.conf
This will call up a text editor with the configuration file. Find the line that says “vm.swappiness=60” and change the 60 to 10, taking care to change nothing else in the file. Save the file and you’re done.
Tip No. 2: Free up more memory
Still from Adelstein, we’re going to free up RAM by disabling some virtual consoles that use up memory—even though most people never use them. To do that, we need to edit the inittab file in the etc directory. In the terminal, type:
sudo gedit /etc/inittab
This will again call up the text editor, this time with inittab loaded.
Scroll down until you find the six lines that begin with:
1:2345:respawn:/sbin/getty 38400 tty1
Comment out (just add the hash or “#” symbol in front of) the last four lines as shown above. Save the file.
Tip No. 3: Make OpenOffice snappier.
To make OpenOffice snappier, you can adjust the way it uses memory. To do this, launch the OpenOffice word processor and go to the Tools menu and select Options. Highlight “Memory” on the left panel.
On the right side of the panel, reduce the number of Undo steps to a figure lower than 100. Adelstein suggests 20, but I use 30 steps, just to be safe. I don’t think I’ll have to undo more than that many commands.
Under graphics cache, set “Use for OpenOffice.org” to 128 MB (up from the original 6MB).
Set memory per object to 20MB (up from the default .5MB).
Set the number of objects under “Cache for inserted objects” at 20.
Check OpenOffice.org Quickstarter.
Click the OK button and close OpenOffice. Start it up again to experience the change in speed.
Tip No. 4: Make OpenOffice even snappier.
Unless you use document wizards or the office suite’s database program, you can turn off Java. To do this, got to Tools> Options. On the left-hand panel, click on Java. On the right panel, uncheck the box next to “Use a Java runtime environment.” This will speed up OpenOffice’s loading time.
Tip No. 5: Use faster alternative programs.
One of the neat things about Linux is there are a lot of programs that do basically the same thing, and you can pick the ones you like. While Gnome is the default desktop environment for Ubuntu, programs written for Gnome are not the fastest. Those written for the Xfce interface are generally faster, so we can pick up some extra speed by choosing them instead.
In a previous post, I talked about switching from Gnome’s file manager, Nautilus, to the faster Thunar. Another substitution you can make is to use the faster-loading Mousepad text editor instead of Gedit. You can install Mousepad using the Synaptic Package Manager (System> Administration> Synaptic). Once you’ve installed it, you can substitute “mousepad” for “gedit” in any command-line commands.
Tip No. 6: Make Firefox run faster.
Two years ago, I wrote about a tweak to make Firefox perform better. You can apply the same tweaks to Firefox on Linux.
In summary, type “about:config” in Firefox’s address bar.
Type “pipelining” in the “Filter” text box. This will leave three options on screen.
Double-click network.http.pipelining to turn its value from “false” to “true.”
Do the same for network.http.proxy.pipelining.
Double-click on network.http.pipelining.maxrequests and change “4” to “30.”
Next, type “network.http.max” in the Filter box. This will give you four variables to change.
Set network.http.max-connections to 128
Set network.http.max-connections-per-server to 48
Set network.http.max-persistent-connections-per-proxy to 24
and set network.http.max-persistent-connections-per-server to 12
Reader Erin notes that some of these settings may put too much of a burden on a server. A much simpler way, Erin suggests, is to install the Fasterfox extension and set it to “turbocharge” to get a similar, but moderated effect.
Finally, on any blank space in the browser window, right-click and choose New>Integer
When prompted for a name, type “nglayout.initialpaint.delay” and set its value to 0.
Restart Firefox to see the difference.
Tip No. 7: Optimize broadband settings.
I have to confess that the explanations for these settings went well over my head, but here’s what to do. In a terminal window, type:
sudo gedit /etc/sysctl.conf
or
sudo mousepad/etc/sysctl.conf
Scroll to the bottom and cut and paste these lines.
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 = 0
net.ipv4.tcp_sack = 1
net.ipv4.tcp_fack = 1
net.ipv4.tcp_window_scaling = 1
net.ipv4.tcp_timestamps = 1
net.ipv4.tcp_ecn = 0
net.ipv4.route.flush = 1
Reset your sysctl for these to take effect by typing:
sudo sysctl -p
Tip No. 8: Get faster menus.
Launch a new document in Mousepad and past this line into it:
gtk-menu-popup-delay = 0
Save the file in your home directory (the one that bears your name) under this name:
.gtkrc-2.0
The dot in front of the file name indicates that this is a hidden file. The next time you log in, the menus should be more responsive.
Tip No. 9: Enable concurrent booting.
Concurrent booting takes advantage of dual-core processors and CPUs that feature hyperthreading. To set this up, edit the “rc” file in the /etc/init.d directory:
sudo mousepad /etc/init.d/rc
Find the line that says CONCURRENCY=none and change it to:
CONCURRENCY=shell
Save the file.
There are many more Ubuntu tweaks out there. I’ve included links to the source of most of the information here. Many of the articles below include other tweaks that seemed a bit too risky to try. Always exercise caution when editing configuration files.
Speed-up links:
http://www.linuxjournal.com/node/8308
http://tvease.net/wiki/index.php?title=Tweak_ubuntu_for_speed
http://ubuntudemon.wordpress.com/2006/07/14/desktop-performance-tweaks/
