CSE Roadmap

Core tier · about 3 hours · 7 parts

Part 3 of 7 · 2 min read

vmstat columns

Think of the instrument panel of a plane: speed, height, fuel, engine temperature. A pilot does not read one dial, but looks at all of them for a pattern. The analogy stops in one place: a plane has red marks on its dials, and vmstat has no marks, so you compare with a baseline.

In plain words: vmstat 1 prints a line every second. The columns used here:

Column Meaning Source
r Processes runnable or running (the run queue) /proc/stat
b Processes blocked in uninterruptible sleep (usually disk) /proc/stat
swpd, free, buff, cache Memory in kB (swap used, free, buffers, page cache) /proc/meminfo
si, so Swap in and out, kB per second /proc/vmstat
bi, bo Blocks read and written, per second /proc/vmstat
in, cs Interrupts and context switches per second /proc/stat
us, sy, id, wa, st CPU share: user, system, idle, waiting for I/O, stolen by the host /proc/stat

The first line of vmstat is an average since boot, and later lines are for the one-second intervals. Read the later lines. The st column (steal) is the time that a virtual machine wanted to run but its hypervisor gave the core to another guest (Level 11).

A worked example. On the idle test machine (page 1) one line was r 0 b 0 us 1 sy 0 id 100 wa 0: nothing is waiting, and the processors are idle. That is the baseline. The next two sections change the workload and show how each column moves.

The key lines. Every column answers one USE question. r and id are the processor, si and so are memory, and b, wa, bi and bo are the disk.

Run queue

The run queue is the set of processes that are ready to run and waiting for a processor, plus those running. Its length, shown as r in vmstat, compared with the number of cores, measures processor saturation.

Example: r = 4 on 2 cores means that two processes are waiting for a core.

Check yourself: 1. Which vmstat line is the average since boot? 2. What does a non-zero so show? 3. What does st count?