Skip to content

CONCEPT Cited by 1 source

Last-write-wins

What it is

Last-write-wins (LWW) is a conflict-resolution rule for concurrent updates to the same state: if two replicas update the same field, the one with the later timestamp wins.

The timestamp flavour matters:

  • Wall-clock LWW — uses real-world time. Sensitive to clock skew; can lose correct writes from a node whose clock drifts slightly behind.
  • Logical-clock LWW (Lamport / vector / hybrid-logical clocks) — uses a per-node monotonic counter that increments on every event and advances when receiving a higher counter from another node. Resolves causal ordering without depending on wall-clock sync.

Why LWW over consensus

LWW lets you accept writes at any replica without coordination and still converge deterministically. It's the workhorse conflict-resolution rule for CRDT-backed gossip systems and eventually-consistent stores.

Trade-off: the "loser" write is silently overwritten. In shapes where writes rarely actually conflict (one writer per key), LWW is effectively free. In shapes with hot contention, it silently drops data — picks for this case are application specific (CRDTs, CmRDTs, OT, or consensus).

Canonical wiki instance — cr-sqlite / Corrosion

cr-sqlite resolves row-level CRDT merges via LWW using logical timestamps:

"Updates to tables are applied last-write-wins using logical timestamps (that is, causal ordering rather than wall-clock ordering)."sources/2025-10-22-flyio-corrosion

The shape works at Fly.io because their orchestration model makes workers the source of truth for their own Machines — conflicts between workers are rare by construction.

Seen in

Last updated · 200 distilled / 1,178 read