Section 2.2. vmstat Tool


2.2. vmstat Tool

The vmstat tool provides a glimpse of the system's behavior on one line and is often the first command you run to familiarize yourself with a system. It is useful here because it indicates both CPU utilization and saturation on one line.

$ vmstat 5  kthr      memory            page            disk          faults      cpu  r b w   swap  free  re  mf pi po fr de sr dd f0 s1 --   in   sy   cs us sy  id  0 0 0 1324808 319448 1   2  2  0  0  0  0  0  0  0  0  403   21   54  0  1  99  2 0 0 1318528 302696 480 6 371 0  0  0  0 73  0  0  0  550 5971  190 84 16   0  3 0 0 1318504 299824 597 0 371 0  0  0  0 48  0  0  0  498 8529  163 81 19   0  2 0 0 1316624 297904 3   0 597 0  0  0  0 91  0  0  0  584 2009  242 84 16   0  2 0 0 1311008 292288 2   0 485 0  0  0  0 83  0  0  0  569 2357  252 77 23   0  2 0 0 1308240 289520 2   0 749 0  0  0  0 107 0  0  0  615 2246  290 82 18   0  2 0 0 1307496 288768 5   0 201 0  0  0  0 58  0  0  0  518 2231  210 79 21   0 ... 


The first line is the summary since boot, followed by samples every five seconds. vmstat reads its statistics from kstat, which maintains CPU utilization statistics for each CPU. The mechanics behind this are discussed in Section 2.12.

Two columns are of greatest interest in this example. On the far right is cpu:id for percent idle, which lets us determine how utilized the CPUs are; and on the far left is ktHR:r for the total number of threads on the ready to run queues, which is a measure of CPU saturation.

In this vmstat example, the idle time for the five-second samples was always 0, indicating 100% utilization. Meanwhile, kthr:r was mostly 2 and sustained, indicating a modest saturation for this single CPU server.

vmstat provides other statistics to describe CPU behavior in more detail, as listed in Table 2.2

Table 2.2. CPU Statistics from the vmstat Command

Counter

Description

kthr

 

r

Total number of runnable threads on the dispatcher queues; used as a measure of CPU saturation

faults

 

in

Number of interrupts per second

sy

Number of system calls per second

cs

Number of context switches per second, both voluntary and involuntary

cpu

 

us

Percent user time; time the CPUs spent processing user-mode threads

sy

Percent system time; time the CPUs spent processing system calls on behalf of user-mode threads, plus the time spent processing kernel threads

id

Percent idle; time the CPUs are waiting for runnable threads. This value can be used to determine CPU utilization


The following sections discuss CPU utilization and saturation in greater detail.




Solaris Performance and Tools(c) Dtrace and Mdb Techniques for Solaris 10 and Opensolaris
Solaris Performance and Tools: DTrace and MDB Techniques for Solaris 10 and OpenSolaris
ISBN: 0131568191
EAN: 2147483647
Year: 2007
Pages: 180

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net