CRDTs let multiple replicas accept writes independently. Merges converge to the same result regardless of order. Powers Google Docs, offline apps, Redis Enterprise.

Replica Aadd(x)Replica Badd(y)Replica Cremove(x)State A{x}State B{y}State C{} + tombstoneMerge in any ordersame resultConverged{y} + tombstone(x)
CRDTs: independent updates merged deterministically
Advertisement

The property

Given any two states + any two operations, the merged result is the same regardless of merge order.

The property

Given any two states + any two operations, the merged result is the same regardless of merge order.

Advertisement

G-Counter

Grow-only counter. Each replica tracks its own count. Merge = sum. Commutative, associative, idempotent.

PN-Counter

Positive + Negative counters. Increments in one map, decrements in another. Merge each map by max. Difference = value.

OR-Set

Observed-Removed Set. Each add has a unique tag. Remove marks tag as tombstoned. Merge = union of adds minus tombstones.

Where CRDTs shine

Multi-master DBs, collaborative apps, offline-first mobile. Anywhere coordination is expensive or impossible.

Merges are commutative + associative + idempotent = eventual convergence guaranteed.