Welcome to Linux Forums! With a comprehensive Linux Forum, information on various types of Linux software and many Linux Reviews articles, we have all the knowledge you need a click away, or accessible via our knowledgeable members.
Find the answer to your Linux question:
Site Navigation
Linux Forums
Linux Articles
Product Showcase
Linux Downloads
Linux Hosting
Free Magazines
Job Board
IRC Chat
RSS Feeds
Free Publications

Fernando Apesteguia concludes: "When a distribution is packaged and delivered to clients, it is designed to be fully compatible with most of the computers available in the market. This is a very heterogeneous set of hardware (hard disks, video cards, network cards, etc.). So distribution vendors like Red Hat, SuSe, Mandriva and the rest of them choose some conservative configuration options to assure a successful installation."
Why tuning my system?

This is probably the first thing you want to know. When a distribution is packaged and delivered to clients, it is designed to be fully compatible with most of the computers available in the market. This is a very heterogeneous set of hardware (hard disks, video cards, network cards, etc.). So distribution vendors like Red Hat, SuSe, Mandriva and the rest of them choose some conservative configuration options to assure a successful installation.

For instance, probably you have a very advanced hard disk with some special features that are not being used due to standard configuration settings.

To summarize: your linux distribution goes well but it can goes even better!

For instance, probably you have a very advanced hard disk with some special features that are not being used due to standard configuration settings.

How to know what goes bad?

Once you decide to optimize your system, it would be time to find which points can be improved. To achieve this, you can use these tools:


This tool allows you to view what processes are running in your system. The range of the process you can see goes from your own ones to all-wide system processes. This command shows the PID for the process, the terminal associated, the accumulated time and the name of the process.
You can use ps to monitor what processes are running on your system and which are extensively using the CPU.

USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMANDfernape 2474 0.0 0.1 53944 1648 tty1 Ss 13:02 0:00 -bashfernape 2577 0.0 0.1 52732 1180 tty1 S+ 13:02 0:00 /bin/sh /usr/X11Rfernape 2609 0.0 0.0 5476 720 tty1 S+ 13:02 0:00 xinit /etc/X11/xifernape 2801 0.0 1.1 134360 11768 tty1 S 13:03 0:00 /usr/bin/gnome-sefernape 2854 0.0 0.0 8796 812 tty1 S 13:03 0:00 /usr/bin/dbus-laufernape 2899 0.1 0.9 73576 10112 tty1 S 13:03 0:01 /usr/libexec/gconfernape 2962 0.0 0.0 5244 972 tty1 S 13:03 0:00 /usr/bin/gnome-kefernape 3180 0.0 0.1 53952 1652 pts/0 Ss 13:07 0:00 bashfernape 3249 0.0 0.1 53952 1628 pts/1 Ss 13:09 0:00 bashfernape 3535 0.0 0.0 5440 828 pts/0 R+ 13:18 0:00 ps utop

If you liked ps, you will like top. Top is a very efficient tool to keep track of processes continuously. The tool is invoked by running top at the prompt. With top, you can list processes ordered by CPU or memory usage. To know more about top, please read this article: Using Top More Efficiently.


vmstat provides information about virtual memory, processes, cpu and more. It can be useful to monitor your global system statistics. This tool is a compilation of information that can be gathered from other well-known UNIX commands

[fernape@Hammer ~]$ vmstatprocs -----------memory---------- ---swap-- -----io---- --system-- ----cpu----r b swpd free buff cache si so bi bo in cs us sy id wa0 0 0 598412 17444 222484 0 0 258 39 1040 211 6 2 86 7time

This is a little but useful tool to measure execution times. It takes a command as an argument. Then executes it and shows a brief statistic about time spent by the process. This can help you to find out if a command takes more time than expected. Of course, this is specially useful if you are dealing with a program developed by you, so you can modify your sources and compile again to compare results.

[fernape@Hammer ~]$ time ls -R >/dev/nullreal 0m0.117suser 0m0.057ssys 0m0.046sx11perf

x11perf performs a benchmark over the X server. This command is invoked running x11perf from prompt. It can take a lot of parameters but running x11perf with -all parameter reveals a lot of information (but it will take a while...).

Obviously this information is not very useful if we can not compare it with other. Here is when x11perfcomp is in order. x11perfcomp is a shell script that compares two outputs generated by x11perf. Now, the way to analyze your X server performance is clear: take a snapshot of your server performance, make some changes in the configuration file and other system settings (remember that X window system uses shared memory and other IPC mechanisms that can affect performance), run x11perf again and finally, compare the results with x11perfcomp.

Below is a truncated output of x11perf. It is a very configurable tool, you can specify certain performance tests or tell him to run all available tests.

[fernape@Hammer ~]$ x11perf -allx11perf - X11 performance program, version 1.5The X.Org Foundation server version 60801000 on :0.0from HammerSun Apr 2 13:21:41 2006Sync time adjustment is 0.0895 msecs.40000000 reps @ 0.0001 msec (6890000.0/sec): Dot40000000 reps @ 0.0001 msec (7910000.0/sec): Dot40000000 reps @ 0.0001 msec (7890000.0/sec): Dot40000000 reps @ 0.0001 msec (7790000.0/sec): Dot40000000 reps @ 0.0001 msec (8290000.0/sec): Dot200000000 trep @ 0.0001 msec (7720000.0/sec): Dot50000000 reps @ 0.0001 msec (10100000.0/sec): 1x1 rectangle

Results can be saved by redirecting the output of x11perf to a file. I executed x11perf once and saved the results in test1 file, then I changed some settings in my xorg.conf file and executed the benchmark again saving results in test2 file. Then I compared them:

[fernape@Hammer ~]$ x11perfcomp test1 test21: test12: test21 2 Operation-------- -------- ---------8310000.0 8140000.0 Dot

It appears that my changes were not very appropriate.

When x11perf is used, a white window is showed in the screen as you can see in the picture below. To avoid benchmarking result modification, don't touch that window nor move the mouse over it. The window will disappear when the tests are finished.


One of the most important devices in your machine is the hard drive. It is used whenever a new process is loaded, when a memory region is swapped from memory to hard disk and when it is restored from the swap partition to memory again. And because UNIX like systems makes an extensively use of files for almost everything, it is very important to set up the hard disk properly. Hdparm helps you in benchmarking and setting your hard disk.

For now I only show you how to perform a test for your hard disk. If you are impatient and want to know what parameters you can set, read the next section: Tuning your system

To perform the test, type (change /dev/hda to match your hard disk.):

[root@Hammer ~]# hdparm -tT /dev/hda/dev/hda:Timing cached reads: 1656 MB in 2.00 seconds = 828.13 MB/secTiming buffered disk reads: 102 MB in 3.03 seconds = 33.71 MB/sec

I executed hdparm from root account since it is a restricted tool. We can see transfer rates for cached reads and buffered disk reads. If you want to see your current settings, try:

[root@Hammer ~]# hdparm /dev/hda/dev/hda:multcount = 16 (on)IO_support = 1 (32-bit)unmaskirq = 1 (on)using_dma = 1 (on)keepsettings = 0 (off)readonly = 0 (off)readahead = 256 (on)geometry = 65535/16/63, sectors = 80026361856, start = 0

I recommend you to run the test at least five times to take the mean value. And it is important not to use the rest of the system if it is possible, so the test will be not affected by other block disk requests.

Tuning your system

Now, we will see some tools that help us to fine tuning our system. We will also see some tips that can be useful to save memory and because of that, they are specially important for machines with no much memory.

Disabling system services

In a typical installation a lot of services are running to ensure maximum compatibility and usability experiences to the user. Since this is a good approach for most of people, sometimes, some services are not used at all while your system is up. Because of this, it is a good idea to disable these non used services. You can do this with several programs. In Red Hat based systems, you can use setup in console mode or serviceconf in a graphical session (showed below).

Some of the services you would like to disable are:

  • Network Manager: chooses the best available connection (are you always connected and permanently moving?)
  • bluetooth: if you usually don't work with bluetooth devices you can disable it.
  • cron: disable it if you have not programmed tasks (maybe you would like to run these tasks for yourself instead of schedule them).
  • cups: printer daemon (I have it disabled in my laptop since I don't print from it)
  • iptables: the linux firewall. At your own risk.
  • irda: Same as bluetooth for Infra Red communications
  • irqbalance: disable if you are not working with an SMP system.
  • nfs: you can disable it if you are not sharing your files through NFS.
  • misc. servers (ssh, sftpd...): A lot of servers are launched by default. Do you really want your system becomes a server?
  • vnc: Virtual Network Console. Disable if you don't need remote graphical access to your system.

In Red Hat systems, you can add and remove system services using the chkconfig command (for non graphical sessions) in this way:

chkconfig service on/off

Other systems have their own mechanisms for managing services. See your handbook.

Disabling X at booting.

You would like to disable X or not, depending of the type of user you are. Im a fanatical of the command line, and I have disable X at boot time. When I start my system I log in a console do my work and shut it down. This can save a lot of RAM if you dont mind to deal with bash (or the shell you use). If you want to disable X, go to the /etc/inittab file and change the line:


For this one:


The next time you boot your system, you will be in pure command line. This not only saves memory but it is faster for simply operations, e.g. If I want to insert a line in my movie list file I waste less time in console mode than in graphical mode, waiting for GNOME, Metacity and X server to be loaded.

Removing consoles

One of the cool features of a linux distribution is the availability of several terminals. These terminals are accessed with Ctrl+Fn keys and allows to log in more than once in the system. But sincerely, I have been using Linux since several years ago and I never needed more than three or maybe four terminals at a time. So you can save some memory by disabling some of them. Even more, if you usually use a graphical desktop, you can use one or more gnome-terminals or konsoles, so you can safely left only one additional terminal in your system and free the other ones.

To achieve this, the /etc/inittab file must be modified again. Just comment the lines that set the terminals:

# Run gettys in standard runlevels1:2345:respawn:/sbin/mingetty tty12:2345:respawn:/sbin/mingetty tty23:2345:respawn:/sbin/mingetty tty34:2345:respawn:/sbin/mingetty tty45:2345:respawn:/sbin/mingetty tty56:2345:respawn:/sbin/mingetty tty6Hdparm

At this moment we revisited hdparm. We have seen that it can show disk information but it can set some properties too. The most important options you can try are:

-d: enables/disables DMA transfers.
-X: fine tuning for the DMA transfers.
-A: for look ahead when reading disk blocks.
-c: enable IDE 32 bit support.
-C: very important for laptops (power management features)

As an example, I disable my DMA transfers, look ahead and 32 bit support and run a test:

[root@Hammer ~]# hdparm -A0 -d0 /dev/hda /dev/hda: setting using_dma to 0 (off) setting drive read-lookahead to 0 (off) using_dma = 0 (off) [root@Hammer ~]# hdparm -tT /dev/hda /dev/hda: Timing cached reads: 1580 MB in 2.00 seconds = 789.33 MB/sec Timing buffered disk reads: 8 MB in 3.20 seconds = 2.50 MB/sec

Notice that buffered disk reads have decreased dramatically! It is more than 15x worse (compared to the test performed above...).


Probably this is the best tool for tuning linux systems. It can configure a lot of system parameters while the linux kernel is running. It handles this, by reading and writing to kernel variables through procfs files.

The complete list of available variables is shown by typing:

[root@Hammer ~]# sysctl -a

It would be a waste of time to explain every variable in this long list. Instead of that, if you are curious, you can play with them (most of them are self-explanatory).

My advice: look at networking options.

Installing video card drivers

This is one of the devices that Im sure you are not using all its capabilities if you are working with a stock configuration and installation. The biggest video card vendors, like Nvidia, ATI or Intel provides their own proprietary drivers for linux. This license issue is the reason by which they are not included in most of the distributions.Proprietary drivers can improve your video card performance very much. Lets use x11perf again. I run a deepcopyplane500 test with the Standard VGA driver chosen by my stock installation. I saved the result in test1 file. Then I change to the ATI proprietary drivers for my ATI Radeon Mobility 9700 and run the test again saving the result in test2 file.

The use of x11perfcomp will reveal the big difference between the two drivers.

[fernape@Hammer ~]$ x11perfcomp test1 test2 1: test1 2: test2 1 2 Operation -------- -------- --------- 7.7 54.2 Copy 500x500 n-bit deep plane

Almost 8x better performance with the ATI drivers!

As you can see, it is really a good idea to install the proper optimised driver for your video card.

Going further, you can even improve the performance of the driver. Nvidia and ATI, allows you to install a precompiled package or to generate a new one. The last option allows you to compile the driver for your specific machine instead of use a generic one.

If you choose the recompile option, you will need your kernel sources, but fortunately the installers make a good job and generate the package automatically without additional work.

Drivers for frequency scaling

If you are using a processor with variable frequency (e.g. Centrino or AMD64) you would like to properly set up your processor configuration to save battery charge. Cpufreq is a program that helps you to do this. It can manage Centrino and AMD64 processors, and allows you to control the frequency value by means of an interface under /sys. With cpufreq you can fix the frequency to the minimum value (max. saving), the maximum value (better performance), or let the driver choose when to increase or decrease the frequency.

To install this daemon, you will need libsysfs and a linux kernel capable of frequency scaling. Most of the modern distributions comes with cpufreq installed. Now it is time to configure it. In my case, it was not properly configured so my AMD was at 100% of use all the time.

Above a list of configurable files is showed:

[fernape@Hammer ~]$ ls /sys/devices/system/cpu/cpu0/cpufreq/cpuinfo_max_freq scaling_available_governors scaling_governor cpuinfo_min_freqscaling_cur_freq scaling_max_freq scaling_available_frequencies scaling_driver scaling_min_freq

See documentation for additional information. You can install the cpufreq applet to easily configure your driver.

I want more: Compiling your linux kernel (the easy way...)

The linux kernel is the core of the operating system. It is used permanently when you are working with your distribution. Even when you are executing a hello world program, is the kernel who loads the program, attends to memory requests and executes system calls to perform the actual work you can see.

Due to this, it is very important to have installed and properly configured (and optimized) your linux kernel. Compiling the kernel is a long and complex topic that can't be covered here in depth. However, you can be lucky if your distribution provides default configuration files for the most common architectures. This is the case of the Red Hat based systems. Let's see how to easily recompile our kernel:

First of all, I assume that you have your linux kernel sources properly installed in your machine.

Now, we move to the sources directory, typically something like:


At this moment, we want to start to configure our new kernel.

make gconfig

We could start to configure from scratch but this is not our objective. We could forget an important feature and then our kernel will be possibly broken. So, load a configuration file from configs subdirectory:

These configuration files ensure that you will obtain the same result you had with a stock kernel but with your specific processor optimizations. You can safely load this file and don't worry about anything. The picture below shows the configuration file loaded.

Even more, in my case, I'm sure my processor is an Athlon64 so I can set it in the options and deselect the Generic-x86-64 option.
Then save your settings and continue with the process:

make modules;
make modules_install;

And if needed, create your initrd file.

If you have compiled and installed your kernel successfully, you will take advantage of your system architecture without a big effort.


Linux vendors make a great effort to build optimized versions of linux systems. However the success in installation is very important too. So, the vendors should estimate both factors. Due to this, some parts of the system are not ready to work at maximum performance. Our mission is to find these points and lead them to a better performance state.

Moreover, since vendors want linux become a wide-used operating system, sometimes they start a lot of services that are not usually used. As an advanced user, it is important to disable these services and features to save memory and other system resources.

The best strategy: if you are not using that feature you can safely disable it. You will save system resources.

Linux systems can be fully configured. Let's take advantage of this!

Digg This Article

Rate This Article: poor excellent
Comments about this article
irqbalance: disable
writen by: ssaady on 2006-04-24 12:44:01
does "SMP system" include hyperthreaded systems running SMP kernels? irqbalance: disable if you are not working with an SMP system.
RE: irqbalance: disable written by ssaady:
Please tell more about sysctl commands a
writen by: jllitvay on 2006-04-24 13:28:37
I found very interessant the sysctl options, could you tell us more about the options and the results??? Thanks
RE: Please tell more about sysctl commands a written by jllitvay:
writen by: sammy on 2006-04-24 16:12:24
SMP kernel is needed for hyperthreading, as hyperthreading is essentially 2 cpus to the OS, or on a dual core system (the new PE) it is 4 cpus :)
RE: yea written by sammy:
Yes, SMP Needed
writen by: Sammy on 2006-04-24 16:16:14
Yes, an SMP kernel is needed for hyperthreading support, as hyperthreading essentially appears as 2 CPUs per core to the operating system (ie: new dual core PE appears as 4 cpus with hyperthreading enabled).
RE: Yes, SMP Needed written by Sammy:
Very long
writen by: fernape on 2006-04-25 02:33:45
A large list of variables can be set with sysctl. For instance,if I execute: sysctl -a |grep ipv4|wc -l it reveals 205 IPv4 net variables Network tuning with sysctl can offers great results, depending on your connection type. In addition you can set some kernel variables like semaphores, shared memory segments, etc. Really a ver long variable list... Maybe in a next article :) Best regards
RE: Very long written by fernape:
nice article
writen by: dune73 on 2006-04-25 02:55:52
The problem with lots of online articles these days is their superficial character. A few sentences and two well known concepts and a BIG headline on top. This article goes deeper. Thank you.
RE: nice article written by dune73:
writen by: John on 2006-05-02 12:07:58
Sorry fo my English... Additional virtual console on demand: /etc/inittab 1:2345:respawn:/sbin/mingetty tty1 #2:2345:respawn:/sbin/mingetty tty2 #3:2345:respawn:/sbin/mingetty tty3 #4:2345:respawn:/sbin/mingetty tty4 #5:2345:respawn:/sbin/mingetty tty5 #6:2345:respawn:/sbin/mingetty tty6 kb:2345:kbrequest:/usr/bin/open -s -l -- /bin/login /etc/rc.d/rc.local echo "alt keycode 103 = KeyboardSignal" | /bin/loadkeys You have install package "open" for this work. After start you have one virtual console running on tty1, but pressing "Alt + UpArrow" you got additional virtual console + login on next free tty.
RE: inittab written by John:
Fine Turning
writen by: raja on 2006-05-16 12:12:16
After Completing RHCE i have no idea about monitoring and performance turning. Really nice article. Regards, Raja.
RE: Fine Turning written by raja:
Very good
writen by: Maxchirag on 2006-05-29 11:22:31
its a good article, question may arise how i came to this page, as i know most of the new users may face the same problem(lake of performance of linux) when they work on havy loaded tools. i faced same problem when i work on netbeans and apache tomcat server.... thanks buddy............
RE: Very good written by Maxchirag:
Lack Of Imagination.
writen by: cyberKhaiz on 2006-06-13 19:31:10
A Distinct Lack of Imagination There was a guy riding through the desert on his camel. He had been traveling so long that he felt the need to have sex. Obviously there were no women in the desert so the man turned to his camel. He tried to position himself to have sex with his camel but the camel ran away. The man ran to catch up to the camel and got back on and started to ride again. Soon he was feeling the urge to have sex again so once again he turned to his camel. The camel refused by running away. So he caught up to it again and go on it again. Finally after riding the camel through the whole desert the man came to a road. There was a broken down car with three big chested beautiful blondes sitting in it. He went up to them and asked the women if they needed any help. The hottest girl said , "If you fix our car we will do anything you want." The man luckily knew a thing or two about cars and fixed it in a flash. When he finished are three girls asked, "How could we ever repay you Mr." After thinking for a short while he replied, "Could you hold my camel?" http://tramadolbuy.medicspharm.info/tramadol-180.html - tramadol 180 http://insurance.lfiiw.info/insurance-auto-quotes.html - insurance auto quotes
RE: Lack Of Imagination. written by cyberKhaiz:
security person man guy
writen by: upsetAdmin on 2006-06-23 21:20:21
Where is iostat? where is mpstat? that wonderful SAR stuff????? we're supposed to stand on giants shoulders and few are mentioned U guys are SOOOOO GREEAAATT!
RE: security person man guy written by upsetAdmin:
Hello there
writen by: sweetbabe on 2006-07-31 14:00:53
hi! im kinda a newbie myself, havent been here long but ya know these ppl here are wonderfull, glad u choose to come back and post, they made me feel right at home from the very beginning, never met a more warm welcoming bunch in my whole life, love em all....cheers...looking forward to your posts.
RE: Hello there written by sweetbabe:
english please?
writen by: www.fulloffacts.com on 2006-10-31 15:35:37
Don't the editors correct spelling and grammar of these articles before they post them to the whole planet? That's a shame... Good article. Good points. Will follow.
RE: english please? written by www.fulloffacts.com:
Configuring/Controlling size of pipes
writen by: Steve Ganesh on 2006-10-31 19:27:29
Is there a way to configure size of pipes created in Linux? For example when someone types $ prog1 | prog2 at the shell, if prog1 is faster than prog2 and if prog1 generates indefinite amount of data, pipe will occupy the most of the space of the filesystem, unless we can control pipe size globally. If its size is cotrolled, prog1 will have to wait until prog2 is able to absorb its output. This aspect is important for tuning the Linux. Since I couldn't find it in this forum, I am posting it here. Please help. Thanks, -Steve
RE: Configuring/Controlling size of pipes written by Steve Ganesh:
writen by: test on 2007-02-12 00:32:42
RE: tt written by test:
writen by: ed lee on 2007-05-08 22:23:25
RE: tuning written by ed lee:
writen by: goo on 2007-05-16 20:48:15
RE: sysstat written by goo:
writen by: allabout on 2007-08-07 03:30:08
RE: Ulimit written by allabout:
writen by: allabout on 2007-08-07 03:32:34
RE: Ulimit written by allabout:
System Administrator
writen by: Arunachalam on 2007-09-06 00:03:52
RE: System Administrator written by Arunachalam:
Init tunning
writen by: Marian Marinov on 2007-09-11 02:30:01
Ok, almost everything sad was true and useful, but disabling terminals and X at boot time doesn't give you better performance it just speeds up the boot. There is a lot better way to speed up the boot process and a bit harder. The problem with the boot process is that INIT is starting the processes one by one, waiting each of them to finish. If you edit the init scripts that are used during the boot of the machine and make all commands that you don't need to wait to start in background, you will speed up the boot greatly, without losing functionality as less consoles or missing X at boot. For example you don't need to wait the swapon, ldconfig and any service daemons. However you need to wait the mount of the disks the loading of modules. I have adjusted my INIT scripts and currently I'm in X for less then 30sec after I hit enter on the grub prompt.
RE: Init tunning written by Marian Marinov:
Server or Workstation tuning
writen by: Ragnar MOLLER on 2007-09-11 04:21:21
Your entry about performance tuning is very nice. However I realize that there are two target audiences. - The linux server performance tuning crowd - The linux workstation performance tuning crowd I belong to the first group and feel a lot of the issues: recompiling Linux, bluetooth, etc don't concern me but on the other hand the coverage about process tuning etc could go further. Maybe the forum could be splitted in two server and workstation performance tuning. Maybe it should just evolve and each of the two subjects can be treated in the same. By the way I have come across a document "Linux Overview for Solaris™ Users" by SUN which is quite good.
RE: Server or Workstation tuning written by Ragnar MOLLER:
udp checksum
writen by: Javier Valencia on 2008-02-19 15:59:14
Some body can help me, How can I configure or enable udp checksum in a Suse LInux 9 Enterprise Best regards.
RE: udp checksum written by Javier Valencia:
Linux pipes don't consume disk space! Th
writen by: JimD on 2008-03-04 13:05:59
RE: Linux pipes don't consume disk space! Th written by JimD:
Use hdparm with care
writen by: oscar on 2008-09-16 12:59:37
Read the manpage before using it. Some parameters do serious changes to your hardware. And hdparm -tT can have an impact on currently running processes.
RE: Use hdparm with care written by oscar:
How to do this performance tuning in RHE
writen by: bhagavan on 2008-10-29 07:43:33
RE: How to do this performance tuning in RHE written by bhagavan:
Oprofile, another powerful tools for per
writen by: paul xiong on 2009-03-01 17:22:44
I used ofrofile. It may be more useful at some points. Here is the link for oprofile: http://www.cdncast.net/weibo/?p=613
RE: Oprofile, another powerful tools for per written by paul xiong:

Comment title: * please do not put your response text here