vmstat is a small, venerable tool that prints a summary of virtual memory, CPU utilisation, and block I/O activity at a fixed interval. It is part of the procps suite and reads from /proc, so it works on any Linux system. For a quick look at whether a machine is CPU-bound, memory-bound, or I/O-bound, vmstat is often the first tool to reach for.
vmstat 1 # update every 1 second forever
vmstat 1 10 # 10 samples
vmstat -s # one-shot summary
vmstat -d # disk statistics
Columns to watch:
- r — processes ready to run (high means CPU-bound)
- b — processes blocked (usually on I/O)
- swpd / free / buff / cache — memory
- si / so — swap-in / swap-out (non-zero is a problem)
- bi / bo — block I/O
- us / sy / id / wa / st — CPU percentages (user, system, idle, iowait, stolen)
High wa plus high b points to slow disks; high sy suggests heavy kernel work or too many context switches; non-zero si/so indicates you are swapping. vmstat's first output line is averages since boot, so ignore it and look at the subsequent samples.
Discussed in:
- Chapter 19: Performance and Observability — Memory: free, vmstat, /proc/meminfo
Also defined in: Textbook of Linux