Skip to content
System Design Explorer
reliability

Replication

By Ankur NayakReviewed

Replication keeps copies of the same data on several machines, so the system survives a server or data-centre failure and can serve more reads. The key choices are who accepts writes and whether replicas are updated synchronously.

Replication diagramComponents: App, Leader, Follower 1, Follower 2. Connections: App to Leader (writes); App to Follower 2 (reads); Leader to Follower 1 (sync); Leader to Follower 2 (async).AppServiceLeaderSQL databaseFollower 1SQL databaseFollower 2SQL database
Leader-follower with failover

How it works

In leader-follower (primary-replica) replication, one node accepts writes and streams changes to followers, which can serve reads. If the leader fails, a follower is promoted. Synchronous replication waits for a follower to confirm each write, so no acknowledged write is lost; asynchronous replication is faster but can lose the last few writes on failover and lets followers lag.

In multi-leader and leaderless systems (Cassandra, Dynamo-style stores), several nodes accept writes. They stay available during partitions but must resolve conflicting writes, often with last-write-wins timestamps or quorums: with N replicas, writing to W and reading from R nodes where R + W > N guarantees a read sees the latest acknowledged write.

Replicating across regions protects against losing a whole region, and puts data close to users, but the speed of light makes cross-region synchronous writes slow, so most global systems replicate asynchronously between regions.

Key points

  • Leader-follower is simple; leaderless trades consistency for availability
  • Sync replication: no data loss, higher write latency
  • Async replication: fast writes, replication lag, possible loss on failover
  • Quorums (R + W > N) tune consistency per request

When to use it, and pitfalls

Use it for

  • Any data you cannot afford to lose
  • Read-heavy workloads that outgrow one server
  • Multi-region deployments

Watch out for

  • Reading your own write from a lagging replica
  • Split brain: two nodes both believing they are leader
  • Failover that silently drops asynchronously replicated writes

Trade-offs

Synchronous vs. asynchronous

Synchronous within a region, asynchronous across regions.

Pros: No acknowledged write lost inside the region; Cross-region latency stays off the write path

Cons: A region loss can drop the last few seconds of writes

Used in

Frequently asked questions

What is replication lag?

The delay between a write on the leader and its appearance on a follower. With asynchronous replication it is usually milliseconds but can grow to seconds or more under load, so reads that must see the user's own writes should go to the leader or wait for the follower to catch up.

Sources