Monday, March 26, 2007

Another techgeek on the net!: Feisty performance - Fly like a butterfly

Feisty performance - Fly like a butterfly

Here is a collection of settings that I use to tune the speed and performance of Kubuntu/Ubuntu Feisty and some of the applications I use.

This really makes my feisty run beautifully :)

You use them at your own risk...

I use Kubuntu, simply because KDE is my choice of desktop.
In the following text change kate to gedit if you are using gnome.

Here are some safe and easy editing settings that will change the overall responsiveness of your feisty installation.

1. Disable IPv6
At least I dont need IPv6 yet so this is what I do to disable it.
sudo kate /etc/modprobe.d/aliases
And change the line:
alias net-pf-10 ipv6
to:
alias net-pf-10 off #ipv6
This will disable IPv6 on all network interfaces. You need to reboot.

2. Run boot processes in parallel
This will make upstart to run the boot processes in parallel and speed up the boot process.
sudo kate /etc/init.d/rc
Find and change the line:
CONCURRENCY=none
to:
CONCURRENCY=shell

3. Aliasing hostname to localhost
Right or wrong, you decide. But I picked this up in the Ubuntu forums the other day and it does improve the startup of some apps.
sudo kate /etc/hosts
and add you hostname to the first line after localhost like this:
127.0.0.1 localhost yourhost
127.0.1.1 yourhost

4. Disable pango
I know that this is already taken care of in firefox but it still makes a good performance boost to thunderbird and some other apps.
sudo kate /etc/environment
and add:
MOZ_DISABLE_PANGO="1"

5. Preload
It does what you think. It preloads most common used libs and files = faster startup times on your applications.
sudo apt-get install preload

What about prelink?
Prelink is no longer necessary in feisty. Feisty uses a new linking mechanism called DT_GNU_HASH which speeds up the linking process without the need for continuously running prelink.

6. Swappiness
The default value for vm.swappiness is 60 in Ubuntu Feisty whic is a good default value but if you want to tweak the performance a little bit more you can change this value to a lower value to reduce the load of the swap. If you run the follwing command:
sysctl -q vm.swappiness
You will se that the value is set to 60. And by running:
sudo sysctl vm.swappiness=10
You will change the value from 60 to 10 which will make your system write to swap a lot less and I would recommend this to everyone that has 512 mb of memory or more. If you find that you have very little use of swap set the value to 0. This will not disable the swap but it will make your system write to the swap as little as possible and keep as much as possible in memory. This makes a huge improvment when switching between applications since they are now likley to be in physical ram instead of on the swap partition.

To set your value permanent you need to change the sysctl.conf file:
sudo kate /etc/sysctl.conf
Add the line
vm.swappiness=10

To the end of the file. This way it will be set upon boot.

I've found that the value of 5 works very good for my use and I have 1 GB of memory.

7. Profile grub
There is a option to grub called profile which will profile your startup. What it does is that it kind of indexing all the files read during boot/startup and later on it will find and read those files quicker.

Hit the escape button when booting to get to the grub menu.
Select your default boot kernel and hit the e button.
Go down to the second line and hit the e button again.
Add profile to the end of the line and press enter.
Hit the b button to boot with your new option.

The first time it will take a little bit longer to boot because it has to build the index (or whatever they want to call it) but every boot after this will be a lot smoother.
You need to do this every time you update your kernel or have made other huge changes to your system that might affect the files needed during boot.


The following could cause your system to be unstable or even unable to boot so please use them care...

8. sysv-rc-conf
Install sysv-rc-conf and disable the services you don't need at startup.
As an example. On my computer I don't have bluetooth so I don't need to start it at boot time.
So simply disable what ever you don't have or use.

sudo apt-get install sysv-rc-conf
and then run:
sudo sysv-rc-conf

9. Kernel hacking
Even thought the new kernel in feisty is very good and already tuned a bit there still are some things you can do to the kernel the will make your system snappier and boot up even faster.

Use this thread from the ubuntu forums as a guide on how to compile your own kernel.
master kernel thread

What I do is that I make sure to add my file systems I use to the kernel instead of loading them as modules. Take out whatever I don't have or use and then compile my new and hopefully improved kernel ;)

10. Filesystem setup
The choice and use of the file system is a big issue when dealing with performance. Depending on your usage of your system you might need to configure your filesystem different.

For my usage I like to use the following setup (which I think is a good desktop setup)

Mountpoint

filesystem

Size

/boot

ext2

100 MB

/root

LVM, VG=system, xfs

6 GB

/swap

LVM, VG=system, swap

The size of RAM in your computer. Making it smaller and you will not be able to hibernate.

/home

LVM, VG=system, xfs

1 GB, or the rest of the space if that VG

/data

LVM, VG=data, xfs

The rest of the free space

Using the following options in fstab for all my xfs partitions:
noatime,nodiratime,logbufs=8

Using LVM can really speed up the disk performance. And you get a lot of other good stuff with it as well. Read more about LVM here.
I choose to have /root and /home on one VolumeGroup and /data on another simply because I can then split them up on diffrent physical disks and have them spanning over multiple physical disks witch really speeds up the reads and writes.


At the moment this is pretty much it but I will update this as soon as I discover more performance tunings...


Tuning applications

Not so much to add here but this what I like to do.

1. Firefox
Use swiftfox instead. It's optimized for your CPU.
Install the fasterfox add-on
If it's not already set, disable IPv6. In the url enter about:config and find the ipv6 entry and disable it.
Install adblock plus add-on
to disable ad's it helps a lot :)

2. openoffice
If you don't need that extras that java JRE provides then simply disable it openoffice. That's what I do.



Once Feisty is released I will have a script done that all you brave people can run that will do most of this in one go :)

I will also write down the kernel options that I use to compile my kernel for those who are interested.

But until then, use this and enjoy a much faster and smoother running Feisty.

No comments:

如何发掘出更多退休的钱?

如何发掘出更多退休的钱? http://bbs.wenxuecity.com/bbs/tzlc/1328415.html 按照常规的说法,退休的收入必须得有退休前的80%,或者是4% withdrawal rule,而且每年还得要加2-3%对付通胀,这是一个很大...