Prometheus & TSDB Errors // SeriesStore Lab
Prometheus TSDB Compaction OOM Kill (Exit 137)
Prometheus buffers raw samples in a 2-hour head block before compacting them onto disk, causing 1.5x memory spikes that trigger Linux OOM Exit 137 on 4-16 GB VPS.
Measured TSDB & Cardinality Telemetry
SeriesStore Lab kernel traces show Prometheus consumes 4.5-8.2 KB per active series in normal operation and surges 45-65% during head-to-block compaction or overlapping block merges. Switching to VictoriaMetrics removes the giant in-memory head block and bounds memory via -memory.allowedPercent.
| Subsystem / Signal | Measured Footprint | Operational Impact |
|---|---|---|
| Prometheus Head + Compaction Spike | 6.2 - 11.4 GB / 1M series | Exceeds 8 GB nodes during 2h compaction window |
| VictoriaMetrics Single-Node RSS | 0.85 - 1.25 GB / 1M series | Flat RSS profile; no 2h compaction cliff |
| Container Restart WAL Penalty | 4 - 18 min recovery stall | Prometheus replays gigabytes of WAL on crash |
Step-by-Step Diagnostic & Config Remediation
- Confirm Exit 137 in dmesg or systemd: Run dmesg -T | grep -i -E "oom-killer|prometheus" to confirm cgroup or kernel OOM termination.
- Check compaction duration metrics: Inspect prometheus_tsdb_compaction_duration_seconds_sum to spot overlapping compaction spikes.
- Migrate ingest to VictoriaMetrics: Deploy single-node VictoriaMetrics on an InterServer $6/TB slice or Vultr HF node using 0.8-1.3 KB/series.
dmesg -T | grep -i -E "oom-killer|killed process|prometheus" journalctl -u prometheus --since "2 hours ago" | grep -i compaction # Prometheus: 4.5-8+ KB/series (+1.5x compaction) | VictoriaMetrics: 0.8-1.3 KB/series
Diagnostic FAQ
Why does Prometheus OOM kill every 2 hours on the dot?
Prometheus cuts and compacts its in-memory head block every 2 hours, temporarily holding both the active head chunks and new compacted index tables in RAM.
Does VictoriaMetrics suffer 2-hour compaction OOM spikes?
No. VictoriaMetrics flushes small parts continuously to disk and merges them incrementally within -memory.allowedPercent bounds.