Reliability lab / Measurement method

How Much CPU Does docker stats Use? Measured on a Mini PC

Polling docker stats inflated measured idle CPU by 29.7% on a Beelink EQi12 mini PC — 21.9% vs 16.9% in a same-day two-run comparison. Raw data and a low-overhead method.

On the tested $200-class Beelink EQi12 mini PC, a monitoring loop that called docker stats once per 5-second cycle raised measured background CPU from 16.9% to 21.9% — a 5.0 percentage-point bias, or 29.7% relative inflation — and nearly quadrupled the standard deviation of the readings (7.32 vs 2.0), while the loop itself stretched its own sampling interval from the intended 5 seconds to about 9.2 seconds. If you benchmark a home server while a monitoring script polls containers in the same loop, the monitor is part of your workload. This page shows the two-run comparison, the raw numbers, and the low-overhead method that avoids the problem.

Why this test exists

While assembling the measurement sets behind the 135-measurement readout, one background-resource run produced numbers that looked too busy for an idle machine. The first sampling script did everything in one loop: read CPU and memory counters, then call docker stats for every container, then sleep until the next 5-second tick. The second script split the work — one thin performance-counter request per sample, with container state captured before and after instead of during.

Both runs happened on the same machine within 11 minutes of each other, with the same four containers running and no other deliberate workload change. That makes the pair a clean before/after on a single variable: what the monitoring loop itself does to the numbers it reports.

This matters beyond curiosity. The same per-sample polling pattern is baked into most quick monitoring scripts, uptime checkers and “just log CPU every few seconds” one-liners. If the monitor adds 5 points of CPU on a 6-core laptop-class chip, it adds proportionally more on smaller mini PC chips, and any capacity or idle-power conclusion drawn from those numbers inherits the bias.

The machine and the two runs

Everything below was measured on one Beelink EQi12 (Intel Core i3-1215U, 6C/8T, 16 GB DDR4-3200, WD PC SN540 512 GB NVMe) running Windows 11 with Docker Desktop and four containers: Jellyfin, PostgreSQL 17, nginx and Redis 8. Both runs were recorded on July 13, 2026 (PDT), the first starting 09:41:53 and the second 09:52:31.

ConditionRun A — polling loopRun B — low-overhead
Samples6060
Intended interval5 s5 s
Actual interval (first gaps)9.3 / 9.2 / 9.2 / 8.7 s5.0 / 5.0 / 5.0 / 5.0 s
Actual span8.95 min4.93 min
Per-sample workCPU + RAM counters + docker stats for 4 containersOne CPU + RAM counter request
Container stateDuring every sampleBefore and after the run

Both scripts are published in the EQi12 measurement data repository (CC BY 4.0), together with the raw CSV files this page is computed from: EQi12_SSDIdle_02_IDLE_SAMPLES_5MIN.csv (Run A) and EQi12_SSDIdle_04_LOW_OVERHEAD_IDLE_5MIN.csv (Run B).

One honesty note that the repo also carries: Windows and other resident desktop applications stayed open during both runs. These are background-state samples, not clean-boot idle measurements — the comparison between the runs is valid, but neither average is a clean-idle figure for the machine.

Headline result: the monitor added 5 points of CPU

Metric (60 samples each)Run A — pollingRun B — low-overheadΔ
CPU average21.88%16.87%+5.00 pp (+29.7%)
CPU minimum8.38%13.39%−5.01 pp
CPU maximum36.88%23.05%+13.83 pp
CPU median22.43%16.59%+5.84 pp
Standard deviation7.322.003.7× higher
Range (max − min)28.50 pp9.66 pp~3× wider

Two things stand out beyond the average. First, the variance collapse: the polling run swung across a 28.5-point range while the low-overhead run stayed inside a 9.7-point band. A noisy monitor does not just bias the mean — it makes every individual reading less trustworthy, which is exactly the wrong property for a tool meant to detect anomalies. Second, the minimum tells the real story: Run A’s quietest moment (8.38%) was still below anything Run B saw, meaning the polling overhead was not constant — it arrived in bursts stacked on top of the machine’s true background state.

The five highest CPU samples in Run A (36.88, 36.25, 34.9, 33.82, 32.11%) all land while the loop was actively polling container stats — the observer effect is visible in the raw log, not just the summary.

The cadence evidence: the loop slowed itself down

The polling script was configured to sample every 5 seconds. The timestamps say otherwise: the first four sample gaps in Run A are 9.3, 9.2, 9.2 and 8.7 seconds, and the 60 samples stretch over 8.95 minutes instead of the intended 5.

The arithmetic is simple. If the tick is 5 seconds but samples land every ~9.2 seconds, each monitoring pass consumed roughly 4.2 seconds of wall time — time spent spawning the docker CLI, querying the Docker API for four containers and rendering the output. That is the same work that inflates the CPU counter, seen from the outside through its effect on the schedule.

Run B sharpens the conclusion. It sampled more often — a strict 5.0-second cadence, 60 samples in 4.93 minutes — yet read lower CPU with less variance. If sampling frequency were the driver, Run B should look worse. It does not. The cost lives in the per-sample docker stats call, not in how often you look.

For contrast, the same repo’s 12.57-hour stability run used the per-sample polling pattern at five-minute intervals. At that cadence the per-sample overhead is amortized into noise, which is why a long run is the right shape for health monitoring and a tight loop is the wrong shape for resource measurement. That page’s absolute CPU readings carry the same polling pattern, so treat its peaks as “system under monitor-inclusive load” rather than pure workload cost.

What four idle containers actually cost in RAM

The low-overhead run captured container state immediately before and after the 4.93-minute window, which gives a clean idle RAM footprint per container on this stack:

ContainerBeforeAfterΔ
Jellyfin145.5 MiB146.2 MiB+0.7
PostgreSQL 1739.51 MiB39.28 MiB−0.23
nginx8.633 MiB8.406 MiB−0.23
Redis 8127.1 MiB126.9 MiB−0.2
Combined≈ 320 MiB≈ 321 MiB~flat

All four containers reported healthy in both snapshots, and Jellyfin had been up for 11 hours. Memory readings moved by fractions of a percent across the window — on an idle home-server stack, container RAM is essentially a constant, and the combined footprint of these four services is about 320 MiB on a 16 GB machine. Where that 320 MiB sits inside the machine’s 16 GB is broken down in the RAM budget walkthrough, which contrasts container usage with the 10,232 MB the Windows side was holding at the same time.

The RAM counters also cross-check between the two runs despite measuring different things: Run A logged used memory (10,041-10,370 MB) and Run B logged available memory (5,756-5,946 MB). On a 16 GB machine, ~10.2 GB used leaving ~5.8 GB available is arithmetically consistent, which is a useful integrity check that both runs describe the same system state.

How to monitor without skewing the numbers

The low-overhead pattern that produced the honest half of this comparison is deliberately boring:

  1. One batched counter read per sample. A single Windows performance-counter request (or /proc/stat + /proc/meminfo read on Linux) captured both CPU and RAM in milliseconds.
  2. No docker CLI inside the sampling loop. Container state was read twice — before and after — not during. For long runs, a container-state snapshot every 5-15 minutes is plenty; restarts and health changes are slow events.
  3. Keep the interval honest. If your loop is supposed to tick every 5 seconds and samples land every 9, your monitor is telling on itself. Log the actual gap between samples; a drifting interval is the cheapest possible overhead alarm.
  4. Separate measurement runs from health monitoring. Tight loops answer “is it up right now?” and that is fine — just don’t reuse their CPU numbers as workload evidence. For resource baselines, use the thinnest sampler you can write and run it long, like the stability methodology but with the polling removed.

The same principle shows up in the Docker workload benchmark: every load figure there was measured with the load generator as the only deliberate client, because a busy observer is indistinguishable from a second tenant on a 6-core chip.

Repeatability notes and limits

Fact block (for citation)

FactValueSource
CPU bias from per-sample docker stats polling+5.00 pp (21.88% vs 16.87%, +29.7% relative)EQi12_SSDIdle_02/04 CSVs, 2026-07-13
Sampling interval drift under polling5 s intended → ~9.2 s actual (poll pass ≈ 4.2 s)Same CSVs, timestamp gaps
Standard deviation of CPU readings7.32 (polling) vs 2.00 (low-overhead)Same CSVs, n=60 each
Idle RAM, 4 containers (Jellyfin/PG/nginx/Redis)≈ 320 MiB combined, stable ±0.7 MiBEQi12_SSDIdle_05 summary
MachineBeelink EQi12, i3-1215U, 16 GB, Windows 11 + Docker Desktop/hardware/beelink-eqi12-review/

Conditions: Beelink EQi12 (i3-1215U, 16 GB DDR4), Windows 11, Docker Desktop with 4 containers, July 13 2026, background-state sampling with desktop apps resident. Data: github.com/sohasteve-pixel/eqi12-measurement-data (CC BY 4.0).