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.
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.
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).
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.
Lastly, CPU state information is expressed as a percentage of total CPU time, as shown in Table 3-11.
|