System Design (50 Qs)•Part 3: Distributed Transactions, Consensus & Reliability (26 - 36)
Resolving Concurrent Write Conflicts: Last-Write-Wins (LWW) vs CRDTs.
In Simple Words: When two users update the identical key concurrently across partitioned nodes:
- Last-Write-Wins (LWW): Uses wall-clock NTP timestamp. The update with the highest timestamp overwrites all others. Simple, but clock drift causes silent data loss!
- Conflict-Free Replicated Data Types (CRDTs): Mathematically proven data structures (e.g. G-Counter, PN-Counter, OR-Set) that converge to the identical state regardless of update order.