2007年5月4日星期五

介绍一篇kunbuntu 7.04优化的文章!

Feisty Performance - “Fly Like A Butterfly”


Rate this guide by clicking on the stars above…

Why this guide?

This guide is for tweak geeks, just like myself :)

There is absolutely no need to tweak Feisty since it runs very well with the default installation. BUT there are some things that can be done to make it run just a little bit faster and smoother.

So that’s why. And since it works so great for me why not share my setup with others just like me and hopefully help you get a greater experience out of your computer and Feisty installation.

This is in no way a default set of tweaks that will give the same kind of improvements for everyone and you use them at your own risk.

For some one tweak might work better than for others. It all depends on the hardware and the way you use your system…
Some basic knowledge in Linux is a plus so that you have a basic understanding in what you are doing.

And remember, these tweaks are what I use to get the most out of my Kubuntu Feisty experience. To me it speeds up the boot process and gives me a snappier desktop and applications then the default installation of Feisty.

In general it seems that these tweaks works better on newer hardware and if you got lot’s of RAM (at least 512 MB) and SATA disks.

In my examples I use kate as my editor, if you are using gnome replace kate with gedit. Or if you are a “Uber geek” vi, emacs or whatever your choice of editor is…
And if you are not an daredevil, copy/backup the files you modify before editing them.

Ok then, enough blabbering, lets get to it…

The FLB-script

! YOU DON’T NEED TO DOWNLOAD AND RUN THIS SCRIPT TO APPLY THE FOLLOWING !

Before downloading and running this script you need to comment out the line in /etc/apt/sources.list that starts with:
deb cdrom:[Kubuntu 7.04 _Feisty Fawn…
With a # sign at the beginning of that line

And do I need to remind you of that I run Kubuntu. So obviously some of the apps are KDE apps…

Here is my Fly Like A Butterfly setup script:
flb.script.sh
Download it and run chmod +x on the file. then run:
sudo ./flb-script.sh
From a console
It will make a copy of your original sources.list file to /etc/apt/sources.list.flb-backup.

This script enables the medibuntu and automatix repos for feisty and installs the most common media codecs needed and some applications that I use.
yakuake
rdesktop
sysv-rc-conf
preload
libxine-extracodecs
libmad0
mplayer
mplayer-fonts
libdvdcss2
w32codecs
skype
sun-java6-plugin
sun-java6-fonts
gsfonts-x11
And some other additional packages that are required by those.

I’m no script kid so it is a very simple script. It could probably use a lot of touch ups…

Tuning the system

Disable IPv6

At least I dont need ipv6 yet so this is what I do to disable it. In the future there might be some use of ipv6 but until then I’ll keep disabling it.
sudo kate /etc/modprobe.d/aliases
And change the line:
alias net-pf-10 ipv6
to:
alias net-pf-10 off #ipv6
Now comment out all the lines that has to do with Ipv6 in your hosts file.
sudo kate /etc/hosts

This will disable IPv6 on all network interfaces. You need to reboot.

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

Make sure to check your spelling, one little mistype here and you won’t be able to boot!!!
This one seems to do best if you are using SATA or SCSI but even on my old computer with the old ATA it does make the KDM login screen show up a little bit faster.
There could actually be that this tweak slows down your boot if you are using old hardware…

Aliasing hostname to localhost

Right or wrong, you decide. But I picked this up in the Ubuntu forums some time ago 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

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″

Disable gettys

Thank’s to some anonymous user for the tip.
sudo kate /etc/event.d/tty3
and comment out the lines starting with start and respawn with a number sign (#).
This does not improve my performance at all but it saves a little resources so why not :)

Preload

It does what you think. It preloads most common used libs and application = faster startup times on your applications (this does not increase your boot speed as some might think).
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.

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 improvement when switching between applications since they are now likely 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.

Grub option profile

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.

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

Xorg

This is just a general tip. I will not tell you what to remove. You know best what you need…

If you strip down the xorg.conf you can decrease the amount of resources that xorg will use.
sudo kate /etc/X11/xorg.conf
Remove any unnessesary fontpaths, modules and the wacom devices (unless you need them).
By removing the wacom devices you will also get rid of those anoying errors that usually prints out in the console whenever you run an application.

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 that 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 the file systems and drivers 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 ;)

If you don’t want to compile your own kernel there is now a low-latency kernel in the universe repos that you could try.

Disk and file system setup

This is probably the most important thing to think about when you are about to install your computer. The choice and use of the disks and file system is a huge issue when dealing with performance. Depending on your usage of your system you might need to configure your file system different.

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

Mountpoint File system Size
/boot ext2 100 MB
/ 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 in that VG
/data LVM, VG=data, XFS The rest of the free space

I’m 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 different physical disks and have them spanning over multiple physical disks witch really speeds up the reads and writes.

What about hdparm?
I have not found any use for hdparm on SATA disks (seems to lack support for SATA). But on older disks there are some things you could tune with hdparm.
Anyhow, since I don’t use it I won’t give you any example on how to use it. Simply search for hdparm on the net and you will find plenty :)

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

Tuning applications

At the moment there is not so much to add here but this what I like to do.

Firefox

Use swiftfox instead. It’s optimized for your CPU.
If it’s not already set, disable ipv6. In the url enter about:config and find the ipv6 entry and disable it. And while you are at it change the ui.allow_platform_file_picker to false to change the file dialogs to look a little bit better (if you are a KDE user like me).
Addons I use:
MediaPlayerConnectivity
Opens video stream directly in an external video player
fasterfox
A nice gui to tweak the performance of the browser
adblock plus
to disable ad’s it helps a lot :)
Mouse gestures
Cause it makes the surfing a lot easier…
Theme:
KDEFF
Gives it a little bit more of a KDE look and feel…

Openoffice

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

Q & A

I followed this guide and managed to screw up, now I can’t boot…

Hey, what can I say. Life’s a bitch…
Well ok then. Here’s something that might help.
Boot up your computer with the Feisty desktop cd
mount your root file system and change/restore your files again.
If you are using LVM then apt-get install lvm and then run vgchange -ay to activate your LVM volumes before you can mount them.

没有评论: