TSDB & RAM Tuning
Ingester WAL Recovery, replay_memory_ceiling & fsync Tuning
Cap WAL replay RAM spikes after container restarts and prevent disk fsync stalls during 500+ GB/day ingestion bursts.
replay_memory_ceiling: 2-4GB · checkpoint_duration: 5m
Graceful Shutdown Beats Slow WAL Replay
Always set stop_grace_period: 60s in docker-compose.yml alongside flush_on_shutdown: true so Loki writes in-memory chunks to disk before exiting.
Dedicated WAL Volume on Hybrid Nodes
When pairing fast local NVMe with slower archival disks, mount /loki/wal on NVMe so fsync pauses never block incoming Alloy pushes.
Measured Thresholds & Loki TSDB Parameters
| WAL Parameter | Recommended Setting | Purpose |
|---|---|---|
| checkpoint_duration | 5m | Bounds WAL segment count before flush |
| replay_memory_ceiling | 2GB - 4GB | Prevents OOM during cold restart recovery |
| flush_on_shutdown | true | Flushes open chunks cleanly on docker stop |