Advanced Topic 48 of 51 Distributed Systems & Cloud
CRDTs
Data types that merge concurrent updates without conflicts.
How it works
Conflict-free replicated data types are data structures designed so that replicas can be updated independently and concurrently without coordination and still converge to the same state, because their merge operation is commutative, associative and idempotent. State-based CRDTs merge full states using a join over a semilattice, and operation-based ones broadcast commutative operations. Examples include grow-only counters, PN-counters, grow-only and two-phase sets, observed-remove sets, last-writer-wins registers and sequence CRDTs for text such as RGA and Logoot.
Where it is used
Collaborative editors, offline-first mobile apps, distributed databases such as Riak and Redis Enterprise, shopping carts and presence systems use CRDTs for eventual consistency with automatic merging.
Common pitfall
Metadata such as tombstones and version vectors can grow without bound and needs garbage collection. Semantics of concurrent edits are determined by the type and may surprise users, such as add-wins versus remove-wins. They cannot enforce global invariants like non-negative balances without coordination. Choose the CRDT that matches the intended semantics and test convergence with randomized operations.
Where it fits in the course
CRDTs is topic 48 of 51 in Distributed Systems & Cloud, rated Advanced. It follows Observability. The next topic is Distributed Tracing.
Practice and explore
- Open the interactive lesson, with a mini quiz.
- Take the Distributed Systems & Cloud quiz.
How to study this topic
- Read the explanation above and restate the definition in your own words.
- Open the interactive lesson and answer its mini quiz.
- Read the common pitfall, then write a short example that avoids it.
- Check your understanding in the Distributed Systems & Cloud quiz, and revisit the topic if you miss a question.
Frequently asked questions
What is CRDTs?
Where do people use CRDTs?
What is the most common mistake with CRDTs?
What should I learn before this topic?
How can I practice it?
Is CRDTs hard to learn?
How long does it take to learn CRDTs?
Which topics are related to CRDTs?
What should I study after CRDTs?
Related topics
- Observability (Distributed Systems & Cloud)
- Distributed Tracing (Distributed Systems & Cloud)
- Circuit Breaker Pattern (Distributed Systems & Cloud)
- System Design Case Studies (Distributed Systems & Cloud)