Data Replication Strategies Cheat Sheet

Database replication patterns — leader-follower, multi-leader, leaderless, synchronous vs asynchronous, conflict resolution, and failover strategies.

Last Updated: July 15, 2025

Replication Topologies

TopologyWritesReadsBest For
Leader-FollowerLeader onlyAny replicaRead-heavy, simple ops
Multi-LeaderAny leaderAny replicaMulti-DC, offline clients
LeaderlessAny node (quorum)Any node (quorum)High availability, Dynamo-style

Sync vs Async Replication

ModeProsCons
SynchronousNo data loss — follower always up-to-dateSlow writes — waits for follower ACK; follower down = writes blocked
AsynchronousFast writes — fire and forgetStale reads possible; leader crash = committed writes lost
Semi-SynchronousOne sync follower, rest asyncBest of both — durability + throughput

Quorum Reads & Writes (Leaderless)

ConceptFormulaExample (N=3)
NTotal replicas3 nodes
WWrite quorumW=2 (wait for 2 ACKs)
RRead quorumR=2 (read from 2, pick newest)
ConsistencyW + R > N2+2>3 ✓ (strong consistency)

Conflict Resolution

StrategyHow It Works
Last Write WinsTimestamp-based — simplest, can lose data
CRDTsConflict-free data types — counters, sets, maps that merge automatically
Version VectorsTrack causal history — detect concurrent writes precisely
Application-LevelCustom merge logic — Amazon cart: items never deleted, just merged

Failover Process

1. Detect failure
Heartbeat timeout — usually 30-60 seconds
2. Elect new leader
Node with most up-to-date log wins (Raft: highest term+index)
3. Reconfigure
Clients and followers pointed to new leader
4. Old leader returns
Steps down to follower — catches up via replication log
Pro Tip: Choose async replication for performance (risk: data loss on leader crash), sync for durability (cost: higher write latency). Most systems use semi-sync — one follower is sync, rest async.
Part of the Empire Builder Network