Total Pageviews

Monday, 4 March 2013

Speed up your Ubuntu!

Speeding up your Ubuntu is fun! That way, you'll get more performance out of your computer for free.

There are several tweaks to make Ubuntu run faster. Some are quite safe, some are risky. Here you'll find only the safe ones.

I don't like risky tweaks, because I think that stability and reliability are much more important than a little speed gain. That's why I've collected a couple of speed tips, that you can apply safely and with which you can make your Ubuntu run considerably faster in many cases.

Those tips are mainly how-to's that can be found elsewhere on this website as well, but scattered all over the site. I've bundled them on this page, that only deals with speed gain.

Note: even though you can apply those tips safely, nothing in life is really for free.... You always pay some "price". You disable a particular system service, a couple of nice visual effects or some feature. Each tweak therefore has it's own "price tag". So you should consider before you apply a tip, whether you're willing to pay the "price" for it.



The absolute number 1: decrease swap use

1. This is especially noticeable on computers with relatively low RAM memory (1 GB or less): they tend to be far too slow in Ubuntu, and Ubuntu accesses the hard disk too much. Luckily, this can be helped.

On the hard disk there's a separate partition for virtual memory, called the swap. When Ubuntu uses the swap too much, the computer slows down a lot.

Ubuntu's inclination to use the swap, is determined by a value. The lower the value, the longer it takes before Ubuntu starts using the swap. On a scale of 0-100, the default value is 60. Which is much too high for normal desktop use, and only fit for servers.

Check your current swappiness value:

Click on the grey Ubuntu logo (Dash home). Query: terminal.
Click on Terminal.
Type (use copy/paste):
cat /proc/sys/vm/swappiness

Press Enter.

The result will probably be 60.

First install text editor Leafpad, as that's more fit for this kind of jobs than Gedit (Xubuntu and Lubuntu already have Leafpad by default).

To change the swappiness into a more sensible value, type in the terminal (use copy/paste):
gksudo leafpad /etc/sysctl.conf

Press Enter.

Scroll to the bottom of the text file and add your swappiness parameter to override the default, so copy/paste the following lines:

#
# Decrease swap usage to a workable level
vm.swappiness=10

Close the text file and reboot your computer.

After the reboot, check the new swappiness value:
Click on the grey Ubuntu logo (Dash home). Query: terminal.
Click on Terminal.
Type (use copy/paste):
cat /proc/sys/vm/swappiness

Press Enter.

Now it should be 10.

Note: your machine might benefit from an even bigger decrease in swappiness. A useful rule of thumb might be this:
1 GB RAM or more: swappiness at 10
Less than 1 GB RAM: swappiness at 5

For 512 MB RAM or less: enable zRam

1.1. When your computer has very little RAM (512 MB or less), then of course your best choice is a lightweight member of the Ubuntu family, like Lubuntu. But even then the lack of memory will remain a problem, which will cause your system to slow down from time to time. Even when the swappiness has been decreased to 5.

In that case, you might try to achieve better results by enabling the experimental kernel module zRam. zRam creates a compressed swap file in your RAM. The compression factor is the gain: with that, you "increase" your RAM.

The price you pay for this, is threefold:

- Your processor (CPU) is being taxed more heavily, because it'll have to compress and decompress all the time;

- When the system has filled the RAM swap, it'll start swapping on the hard drive as well. With a heavy burden: the chunk of memory that has been sacrificed for the RAM swap.

- For the time being it's still an experimental module, so this extra layer of complexity might cause instability.

That's why, for the time being, I advise zRam only for computers with very little RAM, and even then only in combination with a swappiness of 5. Furthermore, zRam isn't suitable yet for production computers, but only for test machines and other, non-essential computers.

You can install it as follows:

Click on the grey Ubuntu logo (Dash home). Query: terminal.
Click on Terminal.

Type (use copy/paste):
sudo apt-get install zram-config

Press Enter. Type your password when prompted; your password will remain entirely invisible, not even dots will show, this is normal.

Reboot your computer.

Check
Now check whether it works, with the following terminal command:
cat /proc/swaps

If all has gone well, you should receive a report about one or more /dev/zram "partitions". zRam is active then; no need for further action.

Removal
When you want to remove zRam, it can't be done by the simple terminal command "apt-get remove"; for this you need "apt-get purge". So:
sudo apt-get purge zram-config

Press Enter. Type your password when prompted; your password will remain entirely invisible, not even dots will show, this is normal.

Reboot your computer.

Disable the visual effects: switch to a 2D desktop environment

2. By default, when your video card can handle it, the 3D visual effects are enabled. However, these may cause malfunctions or sluggish performance. You can disable them by switching to a 2D desktop environment.

There are several options for this.

My personal favourite is a switch to the Xubuntu desktop. But there's another option as well:

a. First, install gnome-session-fallback:

Click on the grey Ubuntu logo (Dash home). Query: terminal.
Click on Terminal.
Type (use copy/paste):
sudo apt-get install gnome-session-fallback

Press Enter. When prompted, type your password. Your password will remain entirely invisible, not even dots will show, this is normal.
Press Enter again.

b. Log out. In the login window, click on the Ubuntu logo next to your user name:


Then choose GNOME Classic (No effects) and click OK:

Note: this instruction and these screenshots are for Ubuntu 12.10. In Ubuntu 12.04 you can also choose Ubuntu 2D (Unity 2D). The procedure is the same.

c. Log in again.

Make your Solid State Drive (SSD) run faster

3. Do you have an SSD for hard drive? Then optimize it to make it run faster.

Disable Java in Libre Office

4. Have you installed Java? The performance of Libre Office can be enhanced greatly, when you disable Java in it. This will disable a few features, but usually you won't even miss those.

Toolbar Libre Office Writer - Tools - Options...

LibreOffice - Java:
remove the tick for: Use a Java runtime environment

Turn off some startup applications

5. You can speed up Ubuntu somewhat, by disabling a couple of system services, that may be superfluous for you. This tweak can be compared to tweaking msconfig in Windows.

Click on the grey Ubuntu logo (Dash home). Query: terminal.
Click on Terminal.
Type (use copy/paste):
cd /etc/xdg/autostart/

Press Enter.

Then copy/paste this in the terminal:
sudo sed --in-place 's/NoDisplay=true/NoDisplay=false/g' *.desktop

Press Enter. When prompted, type your password. Your password will remain entirely invisible, not even dots will show, this is normal.
Press Enter again.

Now check the Startup Applications:
Click on the grey Ubuntu logo (Dash home). Query: startup.

Untick what you don't need and reboot your computer (or log out and then log in again).

Note: only remove the ticks, do not remove the application from the list! Keep the tweak easily reversible (you never know). When in doubt: don't do anything, just leave it the way it is.

Examples of system services that many people don't need:
- Bluetooth Manager
- NVIDIA X Server Settings

Note: unticking startup applications is a user preference, so repeat in each user account.

Add-ons and extensions: don't turn your web browser into a Christmas tree

6. You can install a lot of add-ons (extensions) in the web browsers Firefox, Chrome and Chromium. Those add-ons can be very useful, but they have a couple of important disadvantages, because they are "applications within an application":

- they slow your browser down, especially if there are a lot of them;
- they can cause malfunctions; both in each other and in the browser itself;
- it has occurred: add-ons with malicious content. Don't trust them blindly.

So don't turn your browser into a Christmas tree: don't adorn it with lots of add-ons. Limit yourself to only a few add-ons, that are really important for you.

Note: watch out for add-ons that claim that they make your browser faster! Often they do more harm than good. Do not install them: even if one or two of them can really make your browser run noticeably faster, they may damage the stability of your browser.

Speed up your wireless internet

7. For some wireless chipsets, a simple tweak is sufficient for increasing the connection quality a lot. Namely disabling the power management for the wireless chipset. The speed of your wireless internet may then increase also.

You can do that as follows:

A. First, find out how Ubuntu calls your wireless chipset.

Click on the grey Ubuntu logo (Dash home). Query: terminal.
Click on Terminal.
Type:
iwconfig

Press Enter.

You can then not only see the name for your wireless chipset (for example: wlan0), but also whether Power Management is on. When it's off, or when no mention is made of Power Management at all, you don't need to do anything.

Note: in the how-to below, I use the example of a wireless chipset called wlan0. Sometimes it's called something else, like eth1. In that case of course you need to adapt the terminal command lines accordingly.

B. Create an executable text file called "wireless".

Click on the grey Ubuntu logo (Dash home). Query: terminal.
Click on Terminal.
Type:
sudo touch /etc/pm/power.d/wireless

Press Enter. When prompted, type your password. Your password will remain entirely invisible, not even dots will show, this is normal.
Press Enter again.

Now copy/paste this line into the terminal:
sudo chmod 755 /etc/pm/power.d/wireless

Press Enter.

C. Now put a certain text into that empty text file that you've just created.

First install text editor Leafpad, as that's more fit for this kind of jobs than Gedit (Xubuntu and Lubuntu already have Leafpad by default).

Then copy/paste the following line into the terminal:
gksudo leafpad /etc/pm/power.d/wireless

Press Enter.

Now text editor Leafpad launches with the empty text file "wireless".

Copy/paste the following text into the empty text file "wireless":
#!/bin/sh
/sbin/iwconfig wlan0 power off


Save and close the text file.

D. Now close all applications and reboot your computer. Then check in the terminal, by the command iwconfig, whether Power Management for the wireless chipset is off now.

You're done!

Install the latest microcode for your processor (CPU)

8. It may help to improve the performance of your Intel or AMD processor (CPU), when you install the latest microcode for it.

from https://sites.google.com/site/easylinuxtipsproject/speed

https://sites.google.com/site/easylinuxtipsproject/Home