← Lessons

quiz vs the machine

Gold1500

System Design

Conflict Free Replicated Data Types

Data structures that merge concurrent edits automatically without coordination.

5 min read · core · beat Gold to climb

The promise

A CRDT is a data type designed so that replicas can be updated independently and concurrently, then merged without conflicts. No coordination or locking is needed, which makes them ideal for multi leader and offline systems.

Why merging always works

CRDT merge is built to be commutative, associative, and idempotent. That means applying updates in any order, more than once, still reaches the same final state. Every replica that has seen the same set of operations converges to one value.

Common examples

  • Grow only counter each node counts its own increments and merge sums them.
  • Grow only set merge takes the union of elements.
  • Last write wins register keep the value with the highest timestamp and node id.

Removal is harder, so sets often track tombstones to remember deletions.

Where they shine

CRDTs power collaborative editors, shopping carts, and presence systems where users edit shared state while disconnected. The cost is metadata overhead and that some operations like arbitrary delete are tricky to model.

Key idea

CRDTs use commutative associative idempotent merges so concurrent replicas converge to the same state with no coordination required.

Check yourself

Answer to earn rating on the learn ladder.

1. Which properties must a CRDT merge satisfy?

2. Why are CRDTs ideal for offline collaborative editing?

3. What is a common difficulty with CRDTs?