Skip to content

SYSTEM Cited by 1 source

vmstat

What it is

vmstat — "virtual memory statistics" — is a command-line tool that prints a single-line summary of system-wide run-queue, memory, swap, I/O, system, and CPU-time counters per sampling interval. It's one of the oldest Unix performance utilities, originally written for BSD in the 1980s; Linux's port reads the same counters from /proc/stat / /proc/meminfo / /proc/diskstats.

Why it matters on the wiki

vmstat 1 is command #3 in Netflix's [[patterns/sixty-second-performance-checklist|60-second performance checklist]] and supplies the two most load-bearing signals of the whole sequence on one line:

  • r column — number of tasks running on CPU + waiting for a turn. The canonical wiki primitive for CPU saturation. Rule: r > CPU count = saturation. Cleaner than load average because it excludes I/O- blocked tasks.
  • CPU time breakdown (us / sy / id / wa / st) — see concepts/cpu-time-breakdown. On one line: application work vs kernel work vs idle vs disk-wait vs hypervisor-stolen.

Output columns

 procs -----memory---------- ---swap-- -----io---- -system-- ------cpu-----
 r  b  swpd   free   buff  cache    si   so    bi    bo   in   cs us sy id wa st
  • r — tasks running or runnable (CPU saturation).
  • b — tasks in uninterruptible sleep (usually disk I/O).
  • swpd — swap used (KB).
  • free — idle memory (KB). Don't over-interpret; use free -m for the load-bearing accounting.
  • si / so — swap-in / swap-out (KB/s). Non-zero on either → you're paging; host is out of memory.
  • bi / bo — block in / out (blocks/s from/to block devices).
  • in / cs — interrupts and context-switches per second.
  • us / sy / id / wa / st — CPU time breakdown.

Operational conventions

  • First line is since-boot. It reports averages since boot, not the previous second. Skip it.
  • Argument is interval in seconds. vmstat 1 = 1-second samples until Ctrl-C. Very cheap — all counters are /proc reads.
  • Pair with mpstat -P ALL 1 to see per-CPU distribution — vmstat shows system-wide averages that hide single-hot-CPU patterns.

Interpretation rules from the Netflix checklist

  • r > CPU count = CPU saturation.
  • si + so > 0 = swapping; host is out of memory, triage memory before anything else.
  • us + sy > 90 = CPU utilisation near ceiling; check r for saturation.
  • wa > 0 sustained = disk bottleneck; pivot to iostat -xz 1.
  • st > 0 = hypervisor-stolen cycles (co-tenancy signature).

Seen in

Last updated · 319 distilled / 1,201 read