
A deep dive into Single Leader, Multi-Leader, and Leaderless replication algorithms for distributed systems.
Database Replication is the process of keeping a copy of the same data on multiple nodes. Whether you are aiming for high availability, reduced latency, or horizontal scalability, choosing the right replication algorithm is critical.
In this guide, we will explore the three primary algorithms used in modern distributed systems: Single Leader, Multi-Leader, and Leaderless.
This is the most common approach (used by MySQL, PostgreSQL, and MongoDB). One node is designated as the leader (master), and all other nodes are followers (read replicas).
In this setup, more than one node can accept writes. This is typically used for applications spread across multiple geographic data centers.
If two users edit the same data in different data centers simultaneously, a conflict occurs.
Popularized by Amazon’s Dynamo, this approach allows any node to accept writes and reads. Systems like Cassandra and Riak use this model.
To maintain consistency without a leader, these systems use quorums:
Since nodes can go down, systems fix stale data via:
Regardless of the algorithm, asynchronous replication often results in "replication lag." To maintain a good user experience, developers should implement:
| Algorithm | Best For | Main Downside |
|---|---|---|
| Single Leader | Read-heavy apps, general simplicity | Leader is a single point of failure for writes |
| Multi-Leader | Multi-region apps, offline capabilities | Extremely complex conflict resolution |
| Leaderless | High write throughput, high availability | Complexities in eventual consistency |
gemmaI ported the whole Gemma-4 family — E2B, E4B, 12B, 31B, and the 26B-A4B MoE — to run on...
communityHey DEV, I'm Tobore. Let's actually connect. I've been on here for a while now, mostly writing and...
ai(yep, kinda clickbait, just for the funsies 😊) At the beginning of the year, I relaunched my...
aiMy laptop was sitting idle with the fan at full tilt. Nothing was running that I knew of. The culprit...
githubactionsI Built a Thing! TL;DR — Google Gemini-based Pull Request reviews and Issue Triaging for...
aiI've been hearing the word "harness" thrown around a lot lately. I assumed it just meant "the IDE" or...
Workflows from the Neura Market marketplace related to this DeepSeek resource