Skip to main content
What is multi-leader (multi-master) replication in databases? In a traditional single-leader setup, a single primary (leader) accepts all writes and replicates them to read-only replicas. That works well when clients are close to the primary, but it causes high latency and availability issues for globally distributed users. For example, if the leader is in Virginia and users in Sydney must perform writes, each write pays the round-trip latency (often ~200 ms). If the Virginia region becomes unavailable, the entire system becomes write-unavailable. Multi-leader replication solves this by placing a writable leader in each region. Each regional leader accepts local writes and asynchronously exchanges those writes with the other leaders so replicas converge over time. Writes from Sydney are applied locally and then propagated to Virginia, and vice versa. Because each region can accept writes independently, local clients remain available even if another region fails. Why multi-leader? Key benefits:
  • Low write latency for geographically distributed clients.
  • Regional write availability during partial outages.
  • Simplified regional autonomy for local operations.
However, the trade-off is conflicts: concurrent writes to the same key from different leaders can diverge and must be resolved.

How conflicts arise (example)

Imagine two users updating the same row (row 1,000,000) nearly simultaneously:
  • Alan in Sydney writes x = 7 to the Sydney leader.
  • John in Virginia writes x = 9 to the Virginia leader.
Both leaders accept their local write because they are initially unaware of the other update. When leaders replicate changes to one another, the system must pick an authoritative value for x. A naive strategy is Last-Write-Wins (LWW): the write with the later timestamp wins and overwrites the other.
A dark infographic titled "LAST WRITE WINS" showing two database replicas (Virginia and Sydney) with users John and Alan, timestamps, and a value x = 9 recorded in Virginia. It illustrates a replication conflict where the later write wins.
LWW is simple, but it has important drawbacks:
  • Silent data loss: one of the concurrent updates is discarded.
  • Reliance on clock synchronization: physical clock skew can choose the wrong winner.
  • Loss of intent: merging two updates by timestamp discards contextual meaning.

Conflict-resolution strategies

Below is a compact comparison of common strategies for handling conflicts in multi-leader systems. Use the strategy (or combination) that matches your domain semantics and availability/consistency requirements.

Practical patterns to reduce conflicts

  • Route writes by key/customer to a designated regional leader so the same entity is rarely updated in multiple regions.
  • Make operations idempotent where possible.
  • Prefer data types that can be merged deterministically or designed as CRDTs.
  • Surface conflicts to the application for manual or automated resolution when automatic merging is unsafe.
  • Use logical or hybrid clocks to reduce reliance on perfectly synchronized physical clocks.
Design for conflict avoidance whenever possible: shard writes by key or customer, use idempotent operations, and choose merge strategies (CRDTs or deterministic merges) that fit your domain.

When to avoid multi-leader

Multi-leader replication is powerful for global low-latency writes, but it is not a universal solution. Avoid or be cautious when:
  • Your workload has frequent concurrent writes to the same keys from multiple regions and correctness is critical.
  • Your business logic cannot be expressed with mergeable data types or deterministic conflict resolution.
  • You cannot tolerate the operational complexity of conflict detection, resolution, and debugging.
Be careful with last-write-wins: it can silently drop updates and relies on timestamp ordering. If correctness matters, prefer explicit merge strategies, vector clocks, CRDTs, or designs that avoid concurrent writes to the same keys.

Further reading and references

Use these resources to select the right combination of replication, conflict detection, and resolution for your system’s consistency and availability goals.

Watch Video