Interview Prep/Monitoring & Observability/Prometheus and PromQL at Scale

Prometheus takes 20 minutes to restart after a crash. Why, and how do you reduce it?

AdvancedScenarioPrometheus and PromQL at Scale
Answer

Situation read → On start, Prometheus replays the WAL and loads the head block. A large head and a large WAL slow this down.

What I'd do →

  1. Check logs: msg="WAL replay completed" with duration, Replaying WAL, this may take a while.
  2. Reduce series count (see cardinality fixes). Less head data means a shorter replay.
  3. Keep the WAL on fast disk (NVMe/gp3 with enough IOPS).
  4. Enable --storage.tsdb.wal-compression (default on in recent versions) to shrink the WAL.
  5. Run two replicas so one stays up while the other restarts, and use a readiness gate on /-/ready.
  6. Shard if a single instance is too large.

Why → Replay time is proportional to the WAL size, which is proportional to ingested samples since the last head compaction.

Interview tip → Do not use kill -9 or OOM-kill loops: they leave long WALs to replay.

All Monitoring & Observability questions Roadmap: Monitoring & alerting

More on Prometheus and PromQL at Scale