Chapter 9. System Performance

9.1 Using the vmstat Command Tool

The vmstat command reports statistics about processes, virtual memory, paging activity, faults, CPU activity, and disk transfers. A sample of vmstat output report is shown in Figure 103.



Figure 103: vmstat Output Example with Disk Activity

The following sections will discuss some of the frequently referenced fields for analysis from the preceding example of the vmstat report.

9.1.1 Paging Activity Statistics

When processes on the system require more pages of memory than are available in RAM, working pages may be paged out to paging space and then paged in when they are needed again. Accessing a page from paging space is considerably slower than accessing a page directly from RAM. For this reason, constant paging activity can cause system performance degradation. The paging activity is determined by the following four fields.

pi
Number of pages per second paged in from paging space.
po
Number of pages per second paged out to paging space.
fr
Number of pages that must be freed to replenish the free list or to accommodate an active process.
sr
Number of pages that must be examined in order to free fr number of pages.

9.1.1.1 Data Analysis

The following conclusions can be drawn from the various filed values.

9.1.2 CPU Statistics

The following fields of vmstat report determine the status of CPU usage.

id
Percentage of time the CPU is idle (the run queue is empty).
wa
Percentage of time the CPU is idle (with pending local disk I/O).
r
Number of threads (smallest work unit) placed on the run queue per second.
b
Number of threads (smallest work unit) placed on the wait queue per second (awaiting resource or completion of an I/O).
us
Percentage of CPU time spent in user mode.
sy
Percentage of CPU time spent in system mode.

9.1.2.1 Data Analysis

The values of various fields can lead you to the following conclusions:

9.1.3 Determine the I/O for Persistent Storage

The I/O for persistent storage is the I/O (disk reads and writes) initiated by VMM excluding paging space I/O. The following example shows how to calculate I/O for persistent storage using vmstat command with -s option.

# vmstat -s
    3983934 total address trans. faults
     384406 page ins
     218433 page outs
      16928 paging space page ins
      35468 paging space page outs
          0 total reclaims
    1738350 zero filled pages faults
      19584 executable filled pages faults
    2035457 pages examined by clock
        132 revolutions of the clock hand
     393739 pages freed by the clock
      57211 backtracks
          0 lock misses
        161 free frame waits
          0 extend XPT waits
     197637 pending I/O waits
     340980 start I/Os
     340980 iodones
   16706966 cpu context switches
   46963483 device interrupts
          0 software interrupts
          0 traps
  161793600 syscalls

There are 23 separate events reported by the vmstat -s output, but the following four are used to calculate the persistent storage I/O.

page ins
This field is the count of systemwide pages read from disk (including pages read from paging space). When a page is read from disk to memory, this count is incremented. It is a count of VMM-initiated read operations and, with the page outs field, represents the real I/O (disk reads and writes) initiated by the VMM.
page outs
This field is the count of systemwide pages written on to the disk (including pages written to the paging space). The process of writing pages to the disk is count incremented. The page outs field value is a total count of VMM-initiated write operations and, with the page ins field, represents the total amount of real I/O initiated by the VMM.
paging space page ins
This field is the count of pages read from paging space.
paging space page outs
This field is the count of pages written to paging space.

If the value for paging space page ins is subtracted from the (systemwide) value for page ins, the result is the number of persistent pages (files) that were read from disk. Similarly, if the value for paging space page outs is subtracted from the (systemwide) value for page outs, the result is the number of persistent pages (files) that were written to disk.

The preceding example shows that 367478 (384406-16928) number of pages are read from disk and 182965 (218433-35468) number of pages are written to the disk.

These counts apply to the time since system initialization. If you need counts for a given time interval, execute vmstat -s at the time you want to start monitoring and again at the end of the interval. The deltas between like fields of successive reports will be the count for the interval.

9.2 Using the iostat Command Tool