Define scope and reporting intervals
Vmstat combines Linux process-state, memory, swap, block-I/O and CPU observations. It describes the host rather than directly measuring one service’s response time. Record the time, machine, logical processor count and virtualization or container context first. With vmstat 1 5, the initial report normally includes CPU and I/O averages since boot; later reports describe one-second intervals. Process counts and memory quantities are instantaneous even in that initial row. Calling every first-row field a cumulative total would therefore be another mistake. Check the installed procps version for an option that suppresses the initial report. A short incident window must not be compared uncritically with an average over the machine’s entire uptime.
Separate occupancy from movement
Swpd and free describe quantities, while si and so describe swap movement during an interval. Pages left in swap after an earlier pressure episode do not establish continuous swapping now. Separate the earlier reason for eviction from the mechanism delaying present requests. Low free memory alone is insufficient evidence of shortage because cached and reclaimable memory can still be useful; inspect information such as MemAvailable as well. Units depend on the selected option and field. A switch changing memory display units does not necessarily change every I/O quantity in the same way. Keep column names and units in the evidence. Occupancy and movement answer different questions even when both are discussed informally as memory usage.
Interpret runnable and uninterruptible work
The r column concerns runnable work, while b concerns work in uninterruptible sleep. Repeated runnable counts above the processor count suggest competition for execution opportunities. However, the application may be allowed to use fewer CPUs than the host contains. Inspect affinity, cpusets and CPU quotas before assuming that purchasing more processors is the only remedy. An increase in b does not automatically identify a failed disk either; investigate the actual kernel wait. Brief bursts and sustained queues have different implications, and one sample cannot explain every request’s delay. Use process states and focused process observation to identify the work responsible for the apparent contention.
vmstat 1 5
getconf _NPROCESSORS_ONLN
# Record the affected service and its CPU/cgroup limits separately.Turn CPU categories into hypotheses
CPU fields such as us, sy, id, wa and st represent different time categories. High user time can motivate application profiling; increasing system time can motivate investigation of system calls or kernel work. Neither categorization establishes a full cause. In particular, wa is not the service duration of an individual I/O request. Aggregation across CPUs and the presence of other runnable work affect its meaning. Steal time offers evidence about execution unavailable within a virtualized environment, but does not explain all application latency. CPU percentages and per-request waits have different denominators and units. Align windows and use device or scheduling evidence to connect a suspected resource with the observed application behavior.
Compare three hypothetical time series
Compare three hypothetical situations rather than interpreting one counter in isolation. First, substantial swap occupancy with almost no current movement and stable request latency can reflect an earlier episode. Second, sustained movement together with falling available memory and worsening responses motivates investigation of working-set pressure and I/O. Third, a mostly idle host with one slow container can indicate a CPU quota, restricted placement or a single-thread bottleneck. These are reasoning scenarios, not reported measurements from real incidents. The same occupancy or idle percentage can occur under different mechanisms. The purpose of the comparison is choosing the next observation that can distinguish those mechanisms, not assigning a diagnosis from a familiar-looking number.
Narrow the investigation to processes and limits
Once a broad hypothesis is formed, narrow the scope. Use process observation and profiling for CPU work, iostat for a device path, and process memory or pressure information for a memory hypothesis. In a container environment, connect cgroup limits and statistics to the actual affected service. A low host average does not establish spare capacity within a restricted group, while a busy host does not prove the selected service caused the load. Align arrivals, completions, failures and response distributions with the resource observations. Very fine monitoring of every process also has a cost, so select the scope according to the question the initial report raised.
Preserve conditions when evaluating a change
For a before-and-after comparison, preserve input volume and mix, concurrency, CPU and memory restrictions, and sampling intervals. Reducing the displayed swap occupancy does not by itself establish better response time or successful work. A lower CPU percentage caused by rejecting or losing requests is not equivalent to greater efficiency. Record treatment of the initial report, command version, units, resource limits, follow-up observations and the final application metric. Vmstat is valuable because it places several resource changes together. It is not a universal health classifier based on a single threshold. Keep the hypothesis suggested by a counter distinct from the mechanism supported by the later investigation.