[Fsf-friends] Stanley Thomas' blog: GNU/Linux Performance Tweaks
Frederick Noronha [फ्रेडरिक नोरोन्या]
Fri Jun 15 17:09:55 IST 2007
Linux Performance Tweaks
Not too long ago my boss and myself came up with a wise idea to make
a list of all the linux tweaks usually done to improve the performance
of a linux system. The idea has been taken to a higher level and each
and every silly possible change that could improve the performance of
the system has been added. Of course the actual list would be never
ending, but these are a few that I could think of. Do mail me if you
think of more that can be added.
The first thing to look at a brand new machine is its BIOS. There is a
lot of junk in there that you may never require. For example, if the
machine is going to be used as a file server the on-board sound card
is never going to be used, or if the machine is never to be connected
to a lan why leave the on-board lan card enabled. If the system is
going to be run in text mode only the shared graphics memory required
should not be more than 2MB. All these changes should be done
according to requirement.
During installation do try your best to avoid software raid and lvm
unless absolutely required. These are two lovely features but both of
'em degrade performance considerably. The next most important thing is
to use a kernel that's suitable to your processor architecture. For
example, if you have a 686 processor use a i686 kernel, if you have a
586 processor use a i586 kernel and if you have multiple
processors/cores use the smp kernel. These are the 3 most common
kernels provided with any modern distribution.
Most of us know that ext2/ext3 is the filesystem that has to be used
during installation. No doubt that the ext2/ext3 file system is very
reliable but if you are seriously looking forward towards a faster and
much more responsive system ext2/ext3 is a bad option. Xfs is by far
the fastest filesystem, and if you are dealing with many small files
reiserfs is the best. If you have a directory with many different
types of files, try to break it up. it definitely will improve
performance. Oh, and do use a lighter file manager. Something like
Thunar is great.
The next thing of course is to disable the services you never use
frequently. Services like 'timidity' and 'apache' may very rarely be
used by you. Well you can always start them when required. Running
services when not required is such a waste of resources. Imagine
running a service such as 'postgresql' when all that you are doing
with you system is browsing the Internet.
'Prelink" drastically speeds up application start-up times. There are
a lot of benchmarks done with and without prelink just to prove its
superiority. In most modern distributions prelink is very stable and
Avoid using stuff like Kat, Beagle, Evolution etc. etc. At times these
apps make the system so unusable. There are much more lighter apps to
get your work done. Take for instance, to do a quick word processing
job why use 'OpenOffice Writer' when Abiword (which is much more
lighter) can do the job just fine.
Use a light window manager. My best suggestion WindowMaker. Fluxbox
also does a fine job. Well it will take you some time to get used to
it. Hey but life is all about changes. I mean, when i started using
computers i never knew what linux was. You just adapt to whatever
Well, i know that the above suggestion is not a easy one, but if you
are using something like Gnome or KDE avoid using many taskbar
applets. Those are real resource hungry. Also wallpapers, icons and
files/folders on the desktop consume resources. In linux you have a
central storage for each user, so use it for all your files. It keeps
your system a lot cleaner, your desktop clear, and you can keep things
more organized (atleast i can).
My greatest suggestion in this entire article would be to stay abreast
with the latest distro. The only way to achieve this is to have a
separate /home partition. So the next time you install a new distro,
do not format your /home partition but only all the others for the
installer to install the required packages and their related files.
Packages change over time, Xorg is better than Xfree, Alsa is better
than Oss, Udev is better than devfs. Most of all the kernel undergoes
major changes, many of which are performance related.
Most of the latest distros have packages that are compiled using GCC
3.4 and upwards. GCC 3.4 compiles programs so they run at least 7%
faster. Do you really want to miss out on such good performance gains?
For ext3 filesystems "noatime" and "data=writeback" are good options
to have in the '/etc/fstab' file.
/dev/hda1 / ext3
And for reiserfs add the option "notail" but remove "data=writeback"
/dev/hda7 /boot reiserfs noauto,noatime,notail
Six text-mode virtual consoles are absolutely unwanted for a user like
me, and considering that each of these virtual consoles consume memory
turns me off. Comment out the lines for the unwanted virtual consoles
in '/etc/inittab' and issue the command "init q" as root to make
changes done without rebooting.
In most of the modern machines with 512MB and more ram a lot of
swapping is not required. The more the swapping done when there is
enough ram to do the job is a waste of performance. The default value
is vm.swappiness=60. To change it issue "echo 'vm.swappiness=<value>'
>> /etc/sysctl.conf" as root. Then issue #swapoff -a and #swapon -a.
Generally a value from 20-30 is great for most modern machines. Find
the right value that suits your needs.
The swap partition has to be created roughly in the middle of the
harddisk for it to be easily accessed. Since the swap partition is
accessed in very short bursts occasionally its the best option. Yeah,
this is not one of those easily experimentable suggestions.
Coming to the harddisk.. Oh no, this is my most hated piece of
hardware in a computer. It has moving parts, its unreliable and its a
pain to maintain. Sometimes i wish i had an external usb hub with max
capacity thumb drives built into it to use as a storage medium. I
guess it would be enough for my day to day work. I dont know if it
would be faster than a 10000 rpm hdd, but im sure its much more
reliable because it can withstand more shocks, it does not heat up as
much and it has no moving parts. To increase hdd performance there's
nothing better than 'hdparm'. It tests speeds of the drive and give
you a quite a bit of control over the hdd's parameters. With 'hdparm'
you can set the readahead, configure power management, enable/disable
dma, display drive geometry, speed up/down the head movement, set
spindown time and a whole lot of other neat stuff. Once you have got
all options to your liking, add it to the end of '/etc/rc.sysinit' so
that it gets executed towards the end of the system's booting process.
For example a line like this could be added:
hdparm -a1024 -c3 -d1 -m16 /dev/hda
Like i said earlier there are a lot of ways to improve the system's
performance. These are only a few i can think of. Try out 'powertweak'
its good. Readahead, preload, upstart, teardown are good for boot-up,
shutdown, and faster application loading times. Do not forget to
inform me of something that i could add to this list.
June 15th, 2007
Categories: Linux = Desktop . Author: stan . Comments: No Comments
FN: Frederick Noronha
More information about the Fsf-friends