Troubleshooting
Why InfluxDB in Docker keeps CPU high after a restart
Short answer
Stopping Telegraf and rebooting do not idle InfluxDB: other clients' queries, series cardinality and storage maintenance keep influxd busy. Measure the process, container and host CPU over the same interval, then correlate diagnostics that match your InfluxDB version with the CPU timeline before changing any configuration.

On this page
Influxd that keeps burning CPU after Telegraf is stopped and after the host is rebooted is not spending that time on your writes. A five-minute write cadence is almost no write load at all; the remaining work comes from client queries, series cardinality, storage maintenance such as compaction and retention, or a storage file the engine cannot read cleanly. Measure the same interval at three scopes — process, container, host — then correlate diagnostics that match your InfluxDB version with the CPU timeline before changing any configuration.
Match the scopes before you compare numbers #
Three different readings get called "CPU usage", and mixing them is the most common reason a troubleshooting session stalls:
- Host-wide CPU, from a host process monitor such as htop: a percentage of all cores on the machine.
- Container CPU, from the container runtime's stats view (
docker stats): a percentage where 100 percent equals one core. - Process CPU, from the same host monitor filtered to the influxd process: also a share of the total, but attributed to one process.
Worked example, on a 32-vCPU host. The host monitor reads 95 percent total: 0.95 × 32 = 30.4 cores busy. docker stats shows the influxd container at 3000 percent, and 3000 ÷ 100 = 30 cores; the Telegraf container shows 2 percent, about 0.02 cores. Now stop Telegraf: if the influxd figure does not move, nearly all measured load is inside the database process itself, not the writer and not anything else on the host. That single comparison, taken over the same five-minute window, is the fork in the road for everything that follows. If the container figure is small but the host figure is large, the load is not InfluxDB at all, and you are troubleshooting the wrong process.
Also note the shape over time. A load that stays flat for hours is a different problem from the periodic CPU peak an edge controller can show on a fixed timer, which has its own diagnosis and its own fix; correlate the timeline before you conclude the two share a cause.
Why stopping Telegraf cannot idle the server #
Telegraf is one client, not the workload. With it stopped, these consumers remain:
- Queries from other clients. Dashboards, alerting engines, backup jobs, orchestrator health checks, and applications that poll broad time ranges can each consume more CPU than the writes do. A second Telegraf instance that reads the local bucket to feed a cloud copy is a client too, and the way that arrangement loads the database is its own subject.
- Compaction and retention enforcement. The storage engine merges and rewrites files in the background on its own schedule; retention enforcement deletes expired shards. Both consume CPU with no new write anywhere in the timeline.
- Series cardinality. The cost of indexing and executing queries grows with the number of unique series, not with the write interval. A schema that tags every device and every cycle separately can push cardinality high even at a five-minute cadence.
- Startup recovery. After a reboot the engine scans its storage files; a file it cannot load cleanly can send it into repeated scan-and-fail cycles that look exactly like steady load.
A clean application log rules none of this out: routine but expensive work often logs nothing at all.
Identify the version before enabling anything #
Diagnostic interfaces differ between InfluxDB major releases: the internal statistics and query tools of a 1.x installation are not the APIs of later releases, and an endpoint copied from another installation either returns nothing or produces noise. Record the version from the running container image tag or the server's own version output, and inspect the configuration actually mounted into that container. Then use the diagnostic interface documented for that installed release — runtime statistics, request logging, and the query-inspection tools it provides — and follow its documented enablement setting and authentication. Do not expose a diagnostics endpoint broadly on the plant network just to collect one measurement.
Correlate the diagnostics with the CPU timeline #
Capture CPU alongside, on the same clock: request and query counts, write counts, storage-engine and compaction activity, memory, and whatever measure of series count the installed release exposes. The reading you are looking for is the relationship, not any single number:
- CPU rises while request traffic is low → the work is internal: compaction, retention, cardinality-driven indexing, or recovery.
- CPU rises with a specific query pattern → the work is a client, and the diagnostics should name the database and the query shape.
- CPU is flat and high regardless of both → suspect a storage fault or a misread scope, and go back to the process-versus-container comparison.
Change one workload at a time and record its start and stop times. A timeline with two simultaneous changes correlates with everything and proves nothing.
One safety note belongs here: if the diagnostics point at a storage file the engine repeatedly fails to load, do not delete storage files to clear the fault — that discards the historian's records. Use the vendor's documented recovery procedure for the installed release and verify the recovered history before trusting it.
The decision path #
Work the branches in this order:
- CPU falls when one named client pauses → the cause is that client's query pattern. Fix the query frequency and range with the client's owner, keeping the results the application needs.
- CPU stays high with every known client paused → inspect storage diagnostics: compaction schedule, retention settings against the intended data lifecycle, and series growth. Apply only settings documented for the installed version.
- Diagnostics show no matching activity and the logs stay clean → re-verify the scopes and the interval first, then treat the storage-recovery possibility above as live.
A restart is not a remedy in any branch: your own test already showed the load surviving one. And verbose logging is not a diagnostic shortcut — it adds I/O and CPU of its own, so enable only the narrow request logging the release supports, capture a bounded sample, and revert the verbosity afterwards.
When the honest answer is capacity #
If the diagnostics show the database doing exactly the work the plant asked of it — cardinality and compaction the design genuinely requires — and the cores simply run out during those windows, the durable fix is capacity, and the arithmetic of sizing one PC for InfluxDB, Telegraf, Grafana and Node-RED is its own exercise. When the current machine cannot take another core or another tier of storage, replacing it with a fanless mini PC sized for the whole stack is the fallback that remains.
Prove the change before closing #
Repeat the original measurement with the same scope, the same interval and comparable conditions: Telegraf state, other clients, query schedule and storage activity unchanged. A valid result is a sustained reduction in the CPU measure that was originally high, with the required writes still arriving on their cadence and the required queries still succeeding, no accumulating backlog and no new errors in the logs. If CPU stays high, return to the decision path with the correlated diagnostics rather than calling a quiet log or another reboot a fix.
Before signing off the commissioning check, confirm three things: the production client set is active again, the expected data continues to arrive at its configured interval, and the measured database CPU holds within the operating target you set for that deployment.
Questions asked
Why does docker stats show thousands of percent CPU for one container?
docker stats counts 100 percent per core, so 3000 percent means thirty cores on a 32-vCPU host. The host monitor shows the opposite scale: a share of all cores, so 95 percent there means nearly the whole machine. Also check whether a CPU limit is set on the container; a container running under a quota can look busy in docker stats while the runtime throttles it, which changes what the number means.
Can 5-minute data really push a database to sustained high CPU?
Not on its own. One write every five minutes is a negligible write rate for any storage engine; if CPU stays high between writes, the work is coming from queries, from a large number of unique series raising indexing and query cost, from compaction or retention tasks, or from a storage fault. A high cardinality database can burn CPU even while no client is writing at that moment.
Should I delete the storage files to clear the load?
No. That discards the historian's records and is not a fix. A server that crashes or spins on open points at a specific storage file; use the vendor's documented recovery procedure for the installed release, keep a copy of the affected files first, and verify whatever comes back with a restore against known tags, values and timestamps before trusting the history again.
How do I list every client that can reach the database?
Walk the network, not just the containers you remember. Every container on the same Docker network can reach a published database port, so check the network membership of the stack. Then check the data sources configured in dashboards and alerting tools, scheduled backup or replication jobs, and health checks from any orchestrator or monitoring system. Pause one client at a time and note the start and stop times so the CPU correlation stays usable.

