← Lessons

quiz vs the machine

Gold1340

Databases

The Last Write Wins Register

The simplest conflict free replicated value, where a timestamp decides which concurrent write survives, at the cost of silently dropping the other.

4 min read · core · beat Gold to climb

A Simple Convergent Value

A last write wins register is a replicated value that always converges by a simple rule: the write with the highest timestamp wins. When replicas exchange their copies, each keeps the value whose timestamp is larger, breaking ties by node id. Every replica that has seen the same set of writes ends with the same value.

Why It Converges

The rule is commutative and associative: merging in any order gives the same result. This makes the register a conflict free replicated data type, so no coordination is needed at write time. Replicas can accept writes independently and still agree later.

The Cost

The simplicity hides a real loss.

  • When two writes are concurrent, the one with the smaller timestamp is discarded with no record.
  • A clock skew can let a logically newer write lose to an older one that happened to carry a higher timestamp.

So last write wins is right only when losing a concurrent update is acceptable, such as a cached profile field, and wrong when every update must survive, such as a shopping cart.

Key idea

A last write wins register converges by keeping the highest timestamp value, simple and coordination free but silently dropping the losing concurrent write.

Check yourself

Answer to earn rating on the learn ladder.

1. How does a last write wins register resolve concurrent writes?

2. What is the main downside of last write wins?