Scrivio Interview library
ConceptFoundations6 min read · updated 13 November 2026

In multi-leader replication more than one node accepts writes, and the leaders replicate to each other asynchronously, for example one leader per data center or one per device that works offline.

When is multi-leader replication worth its cost, which replication topologies exist between leaders, and what is its central problem?

Multi-leader replication is worth its cost when writes must stay local and keep working while sites are cut off from each other: one leader per region, devices that work offline, and collaborative editing. Leaders exchange changes in an all-to-all, star or ring topology; star and ring stop when one node fails, while all-to-all can deliver changes out of order. Its central problem is write conflicts: two leaders can accept conflicting writes to the same data, the conflict appears only later during replication, and constraints such as uniqueness are not enforced across leaders, so every write path needs a conflict rule.

Why this question is asked

Most systems start with a single leader, and many teams consider a second leader when they expand to another region or build an offline mode. Interviewers ask this concept question to see whether we can name both the real benefits and the price, because adding a leader is easy to configure and very hard to make correct. In this answer, we will recap single-leader replication, look at where multi-leader earns its keep, compare the topologies between leaders, and then spend most of our time on conflicts and the constraints we lose.

1A Quick Recap: One Leader Versus Several

In single-leader replication, one node accepts all writes and sends them to followers in one order. Every follower ends up with the same history, conflicts cannot happen, and a unique index on the leader protects the whole system. The price is that every write travels to the leader. For a user in Sydney writing to a leader in Virginia, that is about 200 milliseconds per round trip, and if the link between regions fails, the remote region cannot write at all.

In multi-leader replication, several nodes accept writes. Each leader applies its own writes immediately and then replicates them asynchronously to the other leaders, which apply them as if they were followers. So each region writes locally and fast, and keeps writing when the other regions are unreachable.

2When Multi-Leader Is Worth It

The first use is multi-region writes: one leader per data center, so writes are local and each region survives an inter-region outage on its own. The second is offline clients. A calendar or note-taking app on a phone is effectively a leader: it accepts edits with no network for hours and syncs later, and the server is just another leader. The third is collaborative editing, where every user's editor applies their changes immediately and exchanges them with others.

Notice what these have in common: the need to accept a write without talking to anyone else. If a system can tolerate a round trip to one leader, the complexity of multi-leader is rarely worth it.

3Topologies Between Leaders

With more than two leaders, we must decide which leader sends its changes to which. There are three classic shapes, and each fails differently.

Replication topologies between leaders
TopologyHow changes travelMain weakness
All-to-allevery leader sends to every other leaderchanges can arrive out of order
Starleaders send to a hub, which forwardshub failure stops all propagation
Ringeach leader sends to the next oneone failed node breaks the ring
All-to-all is the usual choice; the other two need re-routing when a node fails.

In a star or ring, a change hops through other nodes. That keeps connections few, but one failed node can cut the flow: in a ring, a single failure stops propagation for changes that would pass through it until the ring is reconfigured. All-to-all avoids that, but because changes travel on independent links, they can arrive in different orders at different leaders. An update can overtake the insert it depends on. Such causally related writes need ordering metadata, such as version vectors, so a leader can hold back the update until it has seen the insert.

4Avoiding Replication Loops

In a star or ring, a change passes through nodes that forward it, and in any topology a leader receives changes it might send on again. Without care, a change could circle forever. So every change carries its origin, the id of the node where it was first written. A leader that receives a change with its own origin id discards it. MySQL does this with server_id and GTIDs, which record the originating server, and PostgreSQL logical replication uses replication origins so a subscriber can skip changes that came from itself.

5The Central Problem: Write Conflicts

Here is the price. Two users edit the same document title at the same moment, one in each region. Each leader accepts its write immediately and reports success. Seconds later, each leader receives the other's change. Now both changes have been committed and acknowledged, and they disagree. Unlike in single-leader replication, there was no point at which the database could make one of them wait or fail. The conflict is detected only during replication, after both users were told their write succeeded.

So every piece of data written in more than one place needs a conflict resolution rule. Common rules are last write wins by timestamp, which is simple but silently drops one write, merging values where a merge makes sense, for example with CRDTs, keeping both versions and asking a person or application code to choose, or avoiding conflicts by giving each record a home leader so it is only ever written in one place.

6Constraints That No Longer Hold

A unique index protects one leader only. Two users can register the same email address at the same time in two regions; both leaders check their own index, both succeed, and replication then finds two rows with the same email. Auto-increment ids have the same problem, because each leader hands out the next number from its own counter, as the example below shows.

Java
-- region A -- region B, at the same moment
INSERT INTO users(email) VALUES ('a@x.io'); INSERT INTO users(email) VALUES ('a@x.io');
-- ok, id 1001 -- ok, id 1001
-- after replication: both regions hold two users with email a@x.io, and id 1001 twice -> conflict

Designs work around this in a few ways. They avoid database-generated ids in favour of UUIDs, give each leader its own id range, or route writes for constrained data, such as account registration, to a single owning leader. The general rule is to let each leader own a part of the data, by region or by user, so that most writes have exactly one leader and conflicts become rare exceptions.

7Follow-up questions

Is multi-leader the same as active-active?

Active-active usually means several sites serve traffic at once. It may be implemented with multi-leader replication, but also with each site owning a partition of the data, which avoids conflicts. Ask which data each site writes.

How can a system make conflicts rare?

By routing all writes for a record to one home leader, for example the user's home region, and using other leaders only when the home is unavailable. Conflicts then happen only during failover, not on every concurrent edit.

Why does last write wins lose data?

Because when two writes are concurrent, it keeps the one with the higher timestamp and throws the other away without any error, and clock differences between leaders decide which one survives.

8Conclusion

In this answer, we saw that multi-leader replication lets several nodes accept writes and replicate to each other asynchronously, which pays off for local writes in many regions, offline devices and collaborative editing. Leaders can be connected all-to-all, in a star or in a ring, and each change carries its origin so it is not applied twice. The central problem is conflicts discovered only after both writes were acknowledged, plus constraints such as uniqueness that no longer hold across leaders, so designs choose a conflict rule or give each record one owning leader.

What to say in the interviewAbout 90 seconds aloud

Open with

Multi-leader replication means several nodes accept writes and replicate to each other asynchronously. It is worth the cost when writes must be local and keep working while sites are disconnected: one leader per region so users write with low latency and each region survives an inter-region outage, devices that work offline like a calendar app where each phone is effectively a leader, and collaborative editing.

Then, if they want more

Between leaders there are three topologies. All-to-all, where every leader sends to every other, is the usual choice, but changes travel on separate links and can arrive out of order, so causally related writes need ordering metadata. Star and ring use fewer connections, but one failed node stops propagation.

Each change carries its origin node id so a leader never re-applies its own changes, which prevents loops. The central problem is conflicts. Two leaders can accept conflicting writes to the same record at the same time, both are acknowledged, and the conflict only shows up later during replication.

So every write path needs a resolution rule: last write wins, which silently drops a write, a merge such as a CRDT, or application logic. Constraints like unique emails and auto-increment ids are not enforced across leaders either.

That is why I prefer to give each record a home leader, so most data has a single writer and conflicts are rare.

About this answer

Last updated
13 November 2026
Checked
Its structure and format are checked automatically. Use it as a carefully prepared study note: where a detail matters, confirm it against the official documentation for the version you use. What the checks cover
Where the question comes from
Written by Scrivio for practice. It is not taken from an interview.
Report an issue with this answer

Copy the line below and send it to the author with what you found. It carries the address of this page.

Issue with "When is multi-leader replication worth its cost, which replication topologies exist...": https://scrivio-interview-library.netlify.app/architecture/partitioning-and-replication/79b6020cff/