FULL AI ANALYSIS

Prometheus: nightly TSDB compaction windows cause Grafana queries to time out and remote_write backlog growth

Generated Oct 19, 2026, 9:33:36 AM

Analysis summary

Compaction is IO/CPU intensive; massive short-lived ingest produces many small TSDB blocks and tombstones, which triggers expensive compaction work. Remote_write backpressure increases WAL retention, making compaction and memory use worse. Short-term mitigations: increase min-block-duration to reduce compaction frequency, raise WAL/compression settings, and throttle remote_write concurrency/throughput. Medium/long-term: scale by sharding ingestion (multiple Prometheus servers), deploy a remote read/long-term store (Thanos/Cortex) to offload queries, or introduce a write buffer tier that absorbs bursts. Reboots during compaction increase unavailability and risk data loss—prefer configuration changes or horizontal scaling.

Possible causes

High ingest spike producing many small TSDB blocks and tombstones, triggering heavy compaction work

85%

Remote_write throughput insufficient, causing WAL to grow and compaction pressure

70%

Disk IO bottleneck (even NVMe saturated under write pattern) slowing compaction

60%

Prometheus version inefficiency/bug in compaction code for this workload

20%

Suggested fixes

1

Diagnostic step 1

Enable or increase --storage.tsdb.min-block-duration (e.g., to 2h) to lower compaction frequency and test impact on query latency.

2

Diagnostic step 2

Tune remote_write concurrency and batch size (reduce in-flight requests) to avoid WAL backlog; monitor queue_length.

3

Diagnostic step 3

Offload reads: deploy a Thanos sidecar or Cortex read path so queries hit a read replica during compaction.

4

Diagnostic step 4

Increase disk IO (faster NVMe or separate disks) and size Prometheus resources (CPU) temporarily to observe compaction time changes.

5

Diagnostic step 5

If immediate fix needed, stagger ingestion jobs to smooth spikes or temporarily disable some noncritical scrapes during the window.