vmstat


The vmstat command is yet another way to show Linux performance metrics. vmstat reports a lot of information, and it can be difficult to understand what it is telling you.

The output is separated into six categories: process, memory, swap, I/O, system, and CPU. Like iostat, the first sample is an average since the last reboot. Here is a typical vmstat output:

# vmstat -m 5 3 procs                memory      swap          io     system         cpu  r  b  swpd  free buff  cache   si   so   bi  bo   in    cs us sy wa id  3  0   185    23  136   3679    0    0    9  10    0     4  8 18 10 17  1  0   185    22  136   3676    0    0  285  76 2671 28571 18 19  0 63  1  0   185    22  136   3670    0    0  333  41 2876 24252 36 17  0 46


The -m option causes the memory fields to be shown in megabytes. vmstat takes the sample interval and count parameters as many of the other performance commands do.

The process (procs) information has two columns. The r column is the number of runable processes. The b column is the number of blocked processes.

The memory section has four fields reporting how virtual memory is used. Table 3-7 lists them along with their meaning.

Table 3-7. vmstat memory Fields

Field

Description

swpd

Amount of used swap space

free

Amount of free RAM

buff

Amount of RAM used for buffers

cache

Amount of RAM used for filesystem cache


Next up are the swap metrics. Swap is an obsolete term but one that apparently won't go away. A swap involves paging all the memory consumed by a process to or from disk at one time. What a performance hit this would be. What Linux does instead is page to and from disk as needed in small chunks. Thus, we should probably stop saying memory swapped to disk and start saying memory paged to disk. Either way, Table 3-8 explains the fields.

Table 3-8. vmstat swap Fields

Field

Description

si

Amount paged from disk to memory

so

Amount paged to disk from memory


After swap are the two I/O fields. This section provides a short summary to help you determine whether Linux is busy doing a lot of disk I/O. vmstat only provides two fields showing the volume of data moving to and from disk (see Table 3-9).

Table 3-9. vmstat io Fields

Field

Description

bi

Blocks in from disk

bo

Blocks out to disk


The system fields provide a summary of how busy the Linux kernel is performing process management. Interrupts and context switches are listed (see Table 3-10). A context switch is the moving of a process off of or onto a CPU.

Table 3-10. vmstat system Fields

Field

Description

in

System interrupts

cs

Process context switches


Lastly, CPU state information is expressed as a percentage of total CPU time, as shown in Table 3-11.

Table 3-11. vmstat cpu Fields

Field

Description

us

User mode

sy

Kernel mode

wa

Waiting on I/O

id

Idle




Linux Troubleshooting for System Administrators and Power Users
Real World Mac Maintenance and Backups
ISBN: 131855158
EAN: 2147483647
Year: 2004
Pages: 129
Authors: Joe Kissell

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