Pattern
Leader–follower replication
Problem
One node can't handle all reads. And if the node dies, you lose everything.
Context
You have a read-heavy workload and need horizontal read scale + failover.
Solution
One node is the leader; it accepts all writes. N followers replicate the leader's write log asynchronously. Reads can go to any node. On leader failure, promote a follower to leader.
Trade-offs
- Followers are eventually consistent — replication lag causes read-after-write anomalies
- Writes still serialized through the leader — no write scale
- Failover has an outage window (~seconds) for leader promotion
- Synchronous replication improves consistency at the cost of write latency
Failure modes
- Replication lag grows unbounded under write load — followers fall behind, reads get stale
- Split-brain during network partition — old leader and new leader both accept writes
- Follower promoted to leader but wasn't caught up — data loss
When to use
- Read-heavy workloads (100:1 or higher read:write ratio)
- You need HA with automatic failover
- Some staleness in read replicas is acceptable
When NOT to use
- Write-heavy workloads — leader is still the bottleneck
- Strong read-after-write consistency required — either read from leader or use synchronous replication