CPU and memory bottlenecks
Worked example
This is an offline lesson. Data are fictional and Docker commands are unexecuted. Any optional execution requires an authorized disposable VM, a verified context, synthetic data, restricted access and no external transmission. Do not collect secrets or private output. Before any separately authorized Docker query, verify the effective endpoint and builder (including environment overrides), not just the context name. Use only disposable lab resources; a failed check is a stop condition, not permission to retry against a different host.
Synthetic 10-second cgroup v2 observation:cpu.max = 100000 100000 (nominal 1 CPU quota)usage_usec delta = 9,000,000 -> 0.9 CPU averagenr_periods delta=100; nr_throttled delta=35 -> 35% periods throttledmemory.current=420 MiB; memory.max=512 MiBmemory.events oom_kill delta=0; observed latency increasedStaged read-only: docker stats --no-stream bm29-demoThe average CPU consumption is CPU-seconds divided by wall seconds; a 0.9 CPU average is not proof of no throttling during bursts. The fraction of throttled periods is not the fraction of CPU time lost. Check the actual cgroup version and metric semantics before interpreting counters; account for resets. Memory usage and limit are different from working set, and Docker CLI memory reporting may subtract cache on Linux. A zero OOM-kill increment does not establish absence of reclaim, swapping or memory-related delay. Correlate latency with throttling, memory events, I/O waits and application-level metrics, and test one change against a bounded repeatable workload. If capacity permits, a reviewed CPU budget change may test a throttling hypothesis; it does not prove root cause in advance. Keep host headroom, preserve limits and correctness, and avoid intentional OOM or stress tests. Emulation, GC and dependency latency may confound comparisons. The practice computes 0.8 CPU average and 24% throttled periods. Require the same cgroup identity and counter interval; reject resets or invalid denominators rather than interpreting them as improvement. Linux Docker CLI memory usage subtracts inactive-file cache and is not identical to memory.current.
Common mistake
Never infer a bottleneck from one utilization number or remove resource controls simply because response time increased.
Manual practice
For a 5-second window with 4,000,000 usage_usec increase and 12 throttled periods out of 50, calculate CPU average and throttled-period percentage. Give two other signals to distinguish CPU pressure from storage or dependency delay.
Worksheet: lab-fixtures/docker-performance-engineering/08-resource-bottlenecks/scenario.txt.
Check Your Understanding
Solidify your learning with the interactive assessment directly below this lesson.
Concept Quiz & Questions
CPU and memory bottlenecks — Knowledge check
Interpret performance evidence and make a safe operational decision.
What is average CPU use in the example?
What does 35% throttled periods mean?
Does zero OOM-kill delta rule out memory pressure?