Home/Labs/Active-Active Conflict Lab
All 280 Labs
INTERACTIVE LAB🌍

Multi-Primary Conflict Lab (Interactive)

Two regional primaries withdraw from one balance simultaneously; test LWW, CRDTs, vector clocks, and geo-ownership. Execute concurrent cross-region writes on the same row and measure lost updates, convergence, and correctness under each conflict-resolution strategy.

Multi-Primary Active-Active Conflict Lab

Two regional primaries withdraw from one $100 balance at the same instant — watch each resolution strategy react.

US-Primary (Virginia)

$100

local write latency <5ms, async bi-directional replication

EU-Primary (Frankfurt)

$100

accepts writes independently — that is the whole problem

Tip: even when both writes are legitimate, LWW silently destroys one of them. Clock drift decides the winner, not reality.

Active-active masters give every region sub-5ms local writes, but only CRDTs converge mathematically, only vector clocks detect the conflict honestly, and only geo-partitioning avoids it entirely. Banking ledgers should use none of them — keep one owner.

How It Works Under the Hood

Multi-primary replication lets every region accept local writes in milliseconds, but bi-directional async propagation means the same row can be mutated concurrently on two masters. Last-Write-Wins silently destroys the loser and trusts NTP clocks that always drift. CRDTs like PN-counters merge commutatively to identical state everywhere. Vector clocks detect concurrency and hand both branches to application code, while geographic partitioning assigns each record exactly one owning region and dodges conflicts entirely.

Core Architectural Principles

  • Concurrent writes on different primaries converge to one winner (LWW), one merge (CRDT), or an explicit conflict (vector clocks).
  • Clock skew of a few milliseconds lets a fast server overwrite legitimate newer updates under LWW.
  • Geo-partitioned ownership rejects non-owner writes, the safest pattern for ledgers and reservations.
Interview Round Script

Say upfront: "Multi-master trades conflict complexity for local write latency, so I default to single-master plus replicas unless active-active is mandated." For collaborative editing cite CRDTs like Figma or Apple Notes; for balances cite clock-drift danger in LWW; and offer geo-partitioning as the pragmatic answer for region-owned user data.

Key Trade-Offs

Sub-5ms regional writes and region-outage survival versus write-write conflicts, clock-skew data loss, and brutal operational complexity.

Related Curriculum Chapter

Multi-Primary (Multi-Master) Replication

Read Full Chapter Blueprint

Explore More Interactive Labs

View All 280 Labs