CRDTs: conflict-free replicated data types
In short: CRDTs are data structures that can be changed in several places at once and always merge automatically to the same value without conflicts.
In more detail: Their merge operation is commutative, associative and idempotent. Order and duplicate delivery therefore do not matter. They underpin collaborative editing and offline-first apps.
In Depth
- G-counter: Counter that only grows; each node counts its share, merge = maximum per node.
- PN-counter: Two G-counters for plus and minus.
- OR-set: Set with add and remove without conflicts.
- Sequence CRDTs: For text (for example Yjs, Automerge).
- State- vs. operation-based: Send whole states or single operations.
- Drawback: Metadata grows, not every business rule can be expressed.
See also: Consistency models and eventual consistency, Vector clocks and logical time