Home Audience Admin Performance Tuning and Monitoring, Part 1

Performance Tuning and Monitoring, Part 1



The sar utility is a part of the sysstat package, so make sure you have it installed on your machine. The command collects and reports system activity information like the disk’s I/O transfer rates, paging activity, process-related activities, interrupts, network activity, memory and swap space utilisation, CPU utilisation, kernel activities, TTY statistics, etc. It can optionally also take two arguments—an interval in seconds between reports, and the number of times you want the report. But there are many other options that can be explored.

Figure 2 shows a sample output of my system’s CPU activity collected by sar. I am using an interval of 1 second and I want the report to be produced 10 times using the command: sar -u 1 10

Figure 2: A sample sar output for CPU activity
Figure 2: A sample sar output for CPU activity

You can see from the figure that my system doesn’t have too much of load on the CPU. One thing I want you to configure before using sar is to set the time in the 24-hour format, instead of the 12-hour format shown in Figure 2. This is because when we graphically chart all the information for our analysis, a 24-hour format makes more sense. You can configure an alias for sar as shown below:

# alias sar="LANG=C sar"

Now if you run the same command again you will get the time in the 24-hour format. Append the above alias in your ~/.bashrc file to keep it across reboots.

If you want to know about your memory performance using sar, issue the following command: sar -r 1 10 (Figure 3 shows the output on my computer.)

Figure 3: A sample sar output for memory performance
Figure 3: A sample sar output for memory performance

A much better option to analyse the reports is to save them in some file and later, using a graphical plotter like gnuplot, plot the statistics. I can run sar -r 1 10 > ~/mymeminfo & to collect the report in a file that we can look at later.


According to its man page, “The iostat command is used for monitoring the system input/output device loading by observing the time the devices are active in relation to their average transfer rates. The reports then can be used to change the system configuration to better balance the input/output load between physical disks.” The first line generated by iostat is the average since the last boot, so it can be ignored.

The simplest way you can use this command is by simply running iostat without any arguments (Figure 4 shows the output on my computer). It will show you the boot report of all devices and the CPU, since the last boot.

Figure 4: A typical iostat output
Figure 4: A typical iostat output

As you can see in Figure 4 the report also presents me the blocks-read per second (Blk_read/s), the blocks-written per second (Blk-wrtn/s), the total blocks-read (Blk_read) and total blocks-written (Blk_wrtn) since the last boot. This per-second report can be very handy in taking a decision for an upgrade.

I personally find this command very useful in figuring out which partition of my hard disk is under heavy I/O load. So I can use this report for either upgrading my disk or putting that mount on a separate disk. Figure 5 shows the output when I ran this command on my FTP server. (Just look at the output very carefully—it’s self-explanatory.)

Figure 5: FTP server's iostat putput
Figure 5: FTP server’s iostat putput

You can see /dev/sda2 is the partition with maximum blocks-read per second (Blk_read/s) and maximum blocks-read (Blk_read). Why?

I now issue the following command to tell you the reason:

# e2label /dev/sda2

You can see that we have /var mounted on this partition since it’s an FTP server. So these large numbers are justified. I can use these in the future to mount my /var on a separate high speed HDD if this number goes even higher.


  1. Where is the tuning part – please tell us how to tune following item

    1. Disk I/O Writes
    2. Tuning Network waittime/connection/max_number_of_connection
    3. CPU Tuning per process/maximum/minimum
    4. Tuning swap for process and etc


Please enter your comment!
Please enter your name here