Checkpoint latency spikes

On-call incidentHard35 min

Your task

Your write-heavy Postgres primary shows a regular, painful pattern: every few minutes write latency p99 spikes from 5ms to 400ms for 20–30 seconds, then recovers, like clockwork. During each spike, disk write I/O and iowait jump, and the logs show frequent checkpoint activity with checkpoints are occurring too frequently. Traffic is steady, the spikes don't line up with traffic, they line up with each other at a fixed interval. The instance has plenty of CPU. Triage and mitigate.

It covers

  • Checkpoint
  • Io stall
  • Write spikes