Back to roadmap
Module 6 · Relational Data at ScaleDay 05520 min

Read Replicas and Replica Lag

Cheap reads — at the cost of staleness.

Day 055

Read Replicas and Replica Lag

App
service
Primary
datastore
Replica
datastore
Replica
datastore
Signal path
Reads spread across replicas
App
service
writes
Primary
datastore
App
service
reads
Replica
datastore
App
service
reads
Replica
datastore
Memory hook

Read Replicas and Replica Lag: cheap reads

Mental model

shape data so reads and writes stay honest

Design lens

More replicas → more read capacity, more lag risk.

Recall anchors
WinsCosts

Why it matters

Read replicas multiply read capacity by streaming the primary's writes to many readers. They lag — usually milliseconds, sometimes much more under load — which is the operational cost.

Deep dive

Lag spikes: long writes, network blips, vacuum churn.

Read-your-writes: route the user's read to the primary or a replica that's caught up.

Don't run reports on the primary; that's why replicas exist.

Demo / scenario

App suddenly slow for reads.

  1. Replica lag spiked to 10s.
  2. Cause: a long-running ALTER on primary.
  3. Mitigation: route reads to primary while replicas catch up.
  4. Long-term: schedule heavy DDL during off-peak.

Tradeoffs

  • More replicas → more read capacity, more lag risk.
  • Reads from primary cost write capacity.
  • Replica lag must be monitored as a first-class SLI.

Diagram

writesreadsreads
App
Primary
Replica
Replica
Reads spread across replicas.

Mind map

Check yourself

Loading quiz…

Sources & further reading