CPU utilization and load average
Quick answer
CPU utilization measures time spent in processor states. Linux load averages represent runnable tasks and tasks in uninterruptible sleep, not a percentage of CPU use. Compare both with available CPU capacity and workload latency.
A load average of 4 is not 400 percent CPU utilization. Four runnable tasks may fit on four available CPUs, while blocked tasks can also contribute to load. Compare CPU availability, utilization and task states in the same environment.
Prepare the practice environment
Run python3 lab-fixtures/performance/setup.py from the extracted root as an ordinary user. Enter the printed fresh private path and check pwd. Use fresh fixtures, Bash with set -e -o pipefail, LC_ALL=C and umask 077. Run each snippet in a separate Bash process, not your interactive shell. Only private files are used; optional examples require an authorized snapshot VM. Do not change live monitoring or services. All supplied records are fictional; live read-only header checks do not retain measurements. Review the lab guide.
Prerequisites
Review: Capacity planning and postmortems, Scheduling priority and limits, Swap and memory-backed storage.
How it works
Load averages in uptime summarize approximately 1, 5 and 15 minutes using exponential smoothing. A load of four on four available CPUs may suggest busy processors, but blocked tasks can also raise load. CPU capacity in a container may be constrained by quotas and affinity. In vmstat, r counts runnable tasks, b counts tasks blocked waiting for I/O, and us, sy, id, wa and st describe CPU time categories. The first CPU-rate report is since boot; subsequent rows cover sampling intervals. I/O wait is not time that every task is blocked. Inspect per-CPU imbalance with mpstat, and correlate with application response time. In the simplified fixture all non-idle time is executing user or kernel work; real reports have additional categories.
Try the examples
awk -F, 'NR>1 {print $1, $2+$3 "%", "r=" $4, "b=" $5}' cpu.csvThe busy interval suggests CPU contention; the blocked interval needs investigation of waiting work, not an automatic CPU upgrade.
Expected stdout:
busy 90% r=7 b=0blocked 20% r=1 b=6vmstat 1 2 | awk 'NR==2 {for(i=1;i<=NF;i++) if($i=="r") r=1; if(r) print "r column present"}'Two reports are bounded; the check verifies the header only and does not retain host counters.
Expected stdout:
r column presentOptional: compare per-CPU idle and user/system time in an authorized VM with sysstat installed. Output varies.
Manual example; not executed locally. Follow its stated environment restrictions.
Common mistakes
Do not interpret load 4 as 4% or assume low CPU means there is no bottleneck. Compare effective CPU capacity, queues and user-facing latency.
Practice
Compare the two fixture intervals. Explain why the blocked interval can have high load with low execution utilization, and identify one additional measurement for each hypothesis.
Related references
Study: uptime, vmstat, mpstat. These are reference names, not deployed links.
Check Your Understanding
Solidify your learning with the interactive assessment directly below this lesson.
Concept Quiz & Questions
CPU utilization and load average — Knowledge Check
Apply performance-analysis concepts to synthetic fixtures and VM-only scenarios.
What does Linux load average include?
What does the first vmstat CPU rate report cover?
High load with low execution time suggests what?
Why inspect per-CPU data?