What is the WAL and why does Prometheus restart slowly sometimes?
AdvancedConceptPrometheus Architecture
Answer
The Write-Ahead Log records every incoming sample before it is in the head block, so a crash loses nothing that was acknowledged. On startup Prometheus replays the WAL (plus checkpoints and mmapped chunks) to rebuild the head.
With millions of active series and a large WAL, replay can take many minutes and spike memory, causing OOM loops. Mitigations: lower cardinality, enough memory headroom, and keeping chunks_head (mmapped) so less needs replaying. Log line to watch: Replaying WAL, this may take a while.
More on Prometheus Architecture
Describe the Prometheus architecture.BeginnerWhat does a basic prometheus.yml look like?BeginnerWhat is the `up` metric?BeginnerWhat are `job` and `instance` labels and where do they come from?BeginnerHow is the Prometheus TSDB organized on disk?AdvancedHow do you configure Prometheus retention?Beginner