Course contentsShow
← System Design
Lesson 1381 of 1,91934. Data Replication StrategiesFree lesson

Limitations of Last-Write-Wins

Why LWW can cause data loss and when clock skew makes it unreliable across distributed systems.

Limitations of Last-Write-Wins

You'll learn: Why the Last-Write-Wins conflict resolution strategy can silently destroy data and fail in real-world distributed systems.

The Fundamental Problem

Remember that Last-Write-Wins (LWW) resolves conflicts by keeping whichever write has the latest timestamp. Sounds reasonable—except that it guarantees data loss whenever concurrent writes occur. If two clients update the same key simultaneously, one write is discarded entirely, regardless of its actual value or importance.

The Clock Skew Disaster

LWW relies on accurate timestamps across all nodes. But in distributed systems, clock skew is inevitable—different servers' clocks drift apart, sometimes by seconds or more.

Analogy: Imagine two students submitting homework to different teachers. Student A submits at 2:59 PM (according to Teacher 1's watch), Student B submits at 3:01 PM (according to Teacher 2's watch). But Teacher 2's watch is 5 minutes fast! LWW would declare Student B's work "later" even though Student A actually submitted second. Student A's work is lost.

Why This Breaks Down

  • Concurrent writes: Two users editing the same document from different datacenters—one entire edit vanishes without trace
  • Clock drift: A node with a fast clock can perpetually "win," even if its writes are genuinely older
  • No causality awareness: LWW can't distinguish "B happened after seeing A" from "A and B happened independently"
  • Silent failures: Users never know their data was discarded

When LWW Fails Catastrophically

Shopping cart scenario: User adds Item X (timestamp 100), adds Item Y (timestamp 99 due to clock skew). Item Y disappears. User complains they never checked out with Item Y—because the system silently dropped it.

Key Takeaway: Last-Write-Wins trades correctness for simplicity—it will lose data in multi-master systems and is only safe when writes to the same key are extremely rare or losses are acceptable (like caching scenarios).