In distributed systems, replication and sharding are two topics you can hardly avoid.
A single machine has hard limits on CPU, memory, disk, and bandwidth. Once concurrency and data volume grow past a certain point, the system has to scale out across multiple nodes to spread the load. The first step in scaling is usually to split off read traffic—read/write splitting.
But once you introduce multiple replicas, a critical question appears:
Does the write node have to be a single node? Multiple? Or is there no fixed primary?
Different answers lead to three classic replication architectures:
- Single-leader replication (primary-replica)
- Multi-leader replication (multi-master)
- Leaderless replication (Dynamo-style)
Next, we’ll walk through these three architectures, covering their core ideas, how they’re implemented, and the engineering trade-offs.
1. Single-leader replication: the most common and easiest to understand
The core idea of single-leader replication is straightforward:
- Only one leader handles writes
- The other nodes are followers (replicas) that sync data from the leader
- Reads can go to any replica (if you’re willing to read data that may be stale)
This pattern is widely used in relational databases and most traditional distributed systems. It’s the most mainstream replication approach, and the most intuitive.
1.1 Synchronous vs. asynchronous replication (and semi-synchronous)
One of the most important configuration choices in single-leader replication is whether the leader, after a write, waits synchronously for replica acknowledgment or returns immediately and replicates asynchronously.
- Synchronous replication: The leader doesn’t consider a write successful until a replica acknowledges it.
✅ Stronger consistency and higher reliability
❌ A slow replica or network jitter can drag down write latency—or even make writes unavailable - Asynchronous replication: The leader returns as soon as the write succeeds; replicas catch up later.
✅ Lower write latency and higher throughput
❌ You may read stale data, or even lose data if the leader fails - Semi-synchronous replication: Usually requires at least one replica to acknowledge synchronously, with the rest asynchronous.
✅ A compromise between consistency and availability
✅ Common in practice
1.2 Common replication implementation approaches
At its core, replication is about the leader passing “what changed” to the followers.
That makes how the replication log represents those changes critical. There are three main approaches:
- Statement-based replication
The leader sends SQL statements to followers for execution.
✅ Small log volume
❌ Nondeterministic functions, triggers, auto-increment primary keys, and the like can easily make replicas diverge. - WAL / physical log shipping
Physical changes at the storage-engine level are sent to replicas.
✅ Fast recovery and efficient replication
❌ Tightly coupled to the storage format; cross-version upgrades and compatibility get messy. - Logical / row-based replication
Logical events—which row was inserted, updated, or deleted—are sent to replicas.
✅ Decoupled from underlying storage, which helps with CDC, cross-version support, and external consumers.
❌ Logs are usually larger and implementation is more complex.
1.3 Node failures: catch-up recovery & failover
Replication systems will inevitably encounter failures. In single-leader replication, they fall into two main categories:
- Follower failure: After recovery, the follower catches up on missed logs through “catch-up recovery.”
- Leader failure: You need failover—promote a follower to be the new leader and point clients to it for writes.
The challenges here are:- Asynchronous replication may lose data from “acknowledged writes” that hadn’t replicated yet.
- Split brain (two nodes both think they’re the leader) can cause data corruption or loss.
1.4 Replication lag: three types of “read anomalies” under eventual consistency
Single-leader replication can scale reads very efficiently through asynchronous reads, but the price is replication lag—and the “stale reads” it causes.
Three classic user-experience problems:
- Read-your-writes
A user writes data, refreshes immediately, and doesn’t see it → thinks the write was lost. - Monotonic reads
A user sees newer data first, then refreshes and sees older data → “time goes backward.” - Consistent prefix reads
A user sees the “reply” but not the “question” → causality is out of order.
These aren’t theoretical problems—they directly affect product experience.
Fixing them usually means adding stronger read strategies at the application layer (reading from the leader, sticky sessions, read version barriers, etc.), or simply choosing a database that provides strong consistency.
2. Multi-leader replication: a natural fit for cross-region writes and offline scenarios
The core idea of multi-leader replication is:
- Multiple leaders can accept writes
- Each leader asynchronously replicates its writes to the other leaders
- There is no longer a single write entry point
Its most obvious value is a significant reduction in cross-region write latency.
Users can write to the nearest leader, and the write syncs to other regions in the background.
2.1 Common topologies for multi-leader replication
How do writes propagate among multiple leaders? That’s the replication topology:
- Ring topology
Each node forwards only to the next node.
✅ Simple, with few links
❌ Failure of any node can block the replication path. - Star topology
A central node forwards to other nodes.
✅ Simple to manage
❌ The central node becomes a single point of failure and a bottleneck. - Full mesh topology
Every leader sends writes to every other leader.
✅ Best fault tolerance and fastest propagation
❌ Many links and higher engineering complexity.
2.2 The biggest challenge in multi-leader replication: write conflicts
Multi-leader replication is “fast to write,” but it always comes at a price:
Concurrent writes will inevitably conflict.
Conflict-handling strategies generally fall into these categories:
- Conflict avoidance
Use business routing, write home regions, allocation rules, etc., to pin writes for the same data to the same leader as much as possible.
✅ Ideal
❌ Not always possible, especially with offline and real-time collaboration. - LWW: last write wins
Use timestamps to pick one write as the winner and discard the others.
✅ Simplest
❌ Essentially loses data and depends on clocks being correct. - Manual conflict resolution
The system keeps multiple concurrent versions (siblings) and lets the application or user merge them.
✅ No information loss
❌ High cost in both product experience and engineering. - Automatic conflict resolution (CRDT / OT)
Use mergeable data structures or transformable operation sequences so different replicas eventually converge automatically to a consistent state.
✅ Best suited for collaboration, offline-first, and local-first
❌ Complex algorithms and implementation; requires correctly modeling data types and semantics.
3. Leaderless replication: Dynamo-style systems with higher fault tolerance
Leaderless replication is often misunderstood as “just write to any node.”
In reality, its core is:
- Writes are sent in parallel to multiple replicas
- Reads also read from multiple replicas in parallel
- A “read/write quorum” determines whether a read or write succeeded
That’s the approach behind Dynamo-style systems such as Riak, Cassandra, and ScyllaDB.
3.1 Read/write quorum and quorum consistency
Let:
n: total number of replicasw: number of acknowledgments required for a write to succeedr: number of responses required for a read to succeed
When:
w + r > n
the replica sets for reads and writes must overlap, which in theory increases the chance of reading the latest value.
This is quorum consistency.
Its benefits are:
- No leader, so no failover needed
- Failure of any node has less impact on the system
- Request hedging can reduce tail latency
3.2 Leaderless replication is more prone to “concurrent writes”
Because leaderless replication doesn’t enforce a global order, it’s easy to get:
- Different replicas receiving writes in different orders
- Concurrent writes overwriting each other, leaving replicas permanently inconsistent
So leaderless replication has to answer a key question:
Are two writes in an “overwrite relationship” or a “concurrent relationship”?
To solve this, you need to capture the causal dependencies (happens-before) of writes. The classic approach is:
✅ Version vectors
A version vector can be thought of as a causal context with “one counter per replica,” used to distinguish:
- Overwrite writes: The later write includes the history of the earlier one → it can overwrite it.
- Concurrent writes: Neither write includes the other → both must be kept and merged.
Version vectors are also key to making “read from one replica, then write back to another” safe.
Summary: the core trade-offs of the three replication architectures
| Architecture | Write entry point | Consistency | Availability / Fault tolerance | Engineering complexity | Typical scenarios |
|---|---|---|---|---|---|
| Single-leader replication | Single leader node | Stronger (can be linearizable) | Depends on failover | Medium | Traditional OLTP, read scaling |
| Multi-leader replication | Multiple leader nodes | Weaker (conflicts unavoidable) | Stronger across regions | High | Cross-region, offline, collaboration |
| Leaderless replication | No leader node | Mostly eventual consistency | Very strong (no failover) | High | Highly available KV, jitter resistance |
Replication and sharding are foundational skills in distributed system design.
Once you understand the essential differences among the three replication architectures, you can make clearer “architecture choices” and “engineering trade-offs”:
- Are you willing to put complexity in the database layer or the application layer?
- Do you really need strong consistency, or would higher availability and lower latency be better?
- Can you tolerate conflicts? Can you merge them automatically?
Those answers will determine which replication strategy you ultimately choose and shape how the system evolves over the long term.