Multi-Leader Replication
Summary: A replication model where more than one node can accept writes. Each node that accepts a write simultaneously acts as a leader and must forward those writes to other nodes.
Sources: chapter5
Last updated: 2026-04-15
Multi-leader replication (also known as master-master or active/active replication) is a natural extension of the single-leader model. In this setup, each node that accepts a write must forward that data change to all other nodes. Each leader also acts as a follower to other leaders (source: chapter5, p. 168).
Use Cases
Multi-leader replication is rarely used within a single datacenter but is highly appropriate in several scenarios:
- Multi-datacenter operation: Each datacenter can have its own leader, allowing writes to be processed locally and asynchronously replicated to other datacenters. This improves performance and tolerance to network problems between datacenters (source: chapter5, p. 168).
- Offline-capable applications: Applications like calendars or note-taking apps that need to work without an internet connection effectively act as a local leader that must sync with other replicas when back online (source: chapter5, p. 170).
- Collaborative editing: Real-time collaborative tools like Google Docs or Etherpad allow multiple users to edit a document simultaneously. Each user’s local version is like a leader that needs to sync changes with others (source: chapter5, p. 170).
Conflict Resolution
The biggest challenge with multi-leader replication is that write conflicts can occur if two leaders concurrently update the same record (source: chapter5, p. 171). Conflict resolution strategies include:
- Conflict avoidance: Ensuring all writes for a particular record go through the same leader (source: chapter5, p. 172).
- Converging toward a consistent state: Ensuring all replicas eventually arrive at the same final value using techniques like last-write-wins, version-vectors, or crdts (source: chapter5, p. 173).