Pcornel
Linux · Resource Monitoring

CPU

Cheat sheet · https://pcornel.dk/topic.php?topic=2835

Back to the Topic

Answer

CPU monitoring shows how busy the processors are and why: user (us), system (sy), I/O wait (wa), steal (st, a VM waiting for the hypervisor) and idle (id), per CPU and per process.

Remember

High wa means waiting for disk, not CPU shortage. High st in a VM means the host is overcommitted. One process at 100 % on a multi-core system may be single-threaded and limited by one core — check per-CPU with mpstat -P ALL.

First checks

  • mpstat -P ALL 1 — per-core CPU (sysstat)
  • top -o %CPU / htop — live CPU and memory per process
  • vmstat 1 5 — CPU, memory, swap and I/O over time
  • free -h — memory and swap
  • iostat -xz 1 3 — disk utilisation and latency (sysstat)
  • uptime — load averages

Verify in this order

workload → CPU time split (us/sy/wa/st/id) → per core and per process → cause identified

Where it usually breaks

First mismatch in hardware/kernel capability → scheduler/mm/device → cgroup/namespace → process/thread → service/runtime → workload behavior/counters; preserve identity/native diagnostic/pre-state before mutation.

Read-only verification commands unless stated otherwise. Confirm syntax for your platform and release. Full reference: https://pcornel.dk/topic.php?topic=2835

Confirmation

Confirm action

Continue?