A topic in the Open Knowledge Graph — a free, open map of 15,290 topics and the order to learn them in.

CRDTs: Conflict-Free Replicated Data Types

Research Depth 102 in the knowledge graph I know this Set as goal
1topic build on this
373prerequisites beneath it
See this on the map →
Eventual ConsistencyCausal Consistency+1 moreOperational Transformation for Collaborative Editing
crdts replicated-data-types eventual-consistency

Core Idea

CRDTs are data structures that converge automatically without coordination: replicas update independently and the merge operation is commutative and idempotent, guaranteeing convergence to the same state. Examples include counters, sets, and sequences. CRDTs enable offline-first applications and peer-to-peer systems where strong consistency is infeasible.

Explainer

From your study of eventual consistency, you know that replicas in a distributed system can temporarily diverge and must eventually converge to the same state. The hard question is: how do you guarantee convergence without a central coordinator deciding who wins? CRDTs (Conflict-Free Replicated Data Types) answer this by building convergence into the data structure itself. The mathematical trick is that the merge operation forms a join semilattice — it is commutative (merge(A, B) = merge(B, A)), associative (order of pairwise merges does not matter), and idempotent (merging the same state twice has no effect). These properties mean replicas can receive updates in any order, merge them in any order, and always arrive at the same final state.

The simplest example is a G-Counter (grow-only counter). Each of *n* replicas maintains its own counter. To increment, a replica bumps only its own entry. To merge, take the element-wise maximum across all entries. The total count is the sum. Because `max` is commutative and idempotent, all replicas converge regardless of message ordering. A PN-Counter extends this to support decrements by pairing two G-Counters — one for increments, one for decrements — and reporting the difference. Sets work similarly: a G-Set (grow-only set) merges via union, which is naturally a semilattice operation. An OR-Set (observed-remove set) supports both add and remove by tagging each element with a unique identifier so that "add" and "remove" can be distinguished even when they arrive out of order.

The practical value of CRDTs is that they eliminate coordination. In a traditional system, concurrent writes to the same data require either locking (which blocks other replicas and needs network round-trips) or a consensus protocol (which requires a majority of replicas to agree). CRDTs sidestep both: every replica can accept writes locally and immediately, without contacting any other replica. Synchronization happens lazily — replicas exchange state or operations whenever they connect, and the merge function guarantees convergence. This makes CRDTs ideal for offline-first applications (collaborative text editors, mobile apps, local-first software) and peer-to-peer systems where nodes come and go unpredictably.

The tradeoff is expressiveness. Not every operation naturally fits a semilattice. Counters and sets are straightforward, but ordered sequences (like text in a collaborative document) require sophisticated designs like RGA or Logoot. Some application semantics — like enforcing a global uniqueness constraint — are fundamentally impossible without coordination, and CRDTs cannot help there. The design challenge is finding a CRDT that captures the semantics your application actually needs while accepting the ones it does not. When the fit is right, CRDTs provide strong eventual consistency with zero coordination overhead.

Practice Questions 5 questions

Prerequisite Chain

Understanding ZeroThe Number ZeroCounting to FiveCounting to 10Counting to 20Counting a Set of Objects Up to 20Cardinality: The Last Number CountedMatching Numerals to QuantitiesSubitizing Small QuantitiesAddition Within 10Number Bonds to 10Addition Within 20Doubles and Near DoublesDoubles Facts Within 10Near Doubles Facts Within 20Mental Math Strategies for AdditionMental Math: Adding and Subtracting TensAddition Within 100Repeated Addition as MultiplicationMultiplication as Equal GroupsMultiplication: ArraysBasic Multiplication Facts (0s, 1s, 2s, 5s, 10s)Multiplication Facts Within 100Division as Equal SharingDivision as Grouping (Measurement Division)Division: Grouping (Repeated Subtraction) ModelDivision: Fair Sharing ModelDivision as Equal SharingDivision as GroupingBasic Division FactsDivision Facts Within 100Multiplication and Division Fact FamiliesRelationship Between Multiplication and DivisionDivision Facts as Inverse of MultiplicationRemainders and Quotients in DivisionDivision Word ProblemsMulti-Step Word ProblemsSolving Multi-Step Word ProblemsMultiplication Word ProblemsDivision Word ProblemsIntroduction to Long DivisionFactors and MultiplesPrime and Composite NumbersEquivalent FractionsRelating Fractions and DecimalsDecimal Place ValueIntegers and the Number LineComparing and Ordering IntegersAbsolute ValueAdding IntegersSubtracting IntegersMultiplying IntegersIntroduction to ExponentsOrder of OperationsInteger Order of OperationsVariable ExpressionsThe Distributive PropertyVariables and Expressions ReviewIntroduction to PolynomialsAdding and Subtracting PolynomialsMultiplying PolynomialsFactorialPermutationsCombinationsCounting Principles: Addition and Multiplication RulesIntroduction to Graph TheoryPropositional Logic FoundationsLogical EquivalencesBoolean AlgebraBoolean Type and Truth ValuesComparison Operators and Boolean TestsLogical Operators and Boolean AlgebraBoolean Algebra and Fundamental LawsLogic Gates FundamentalsImplementing Boolean Functions with GatesKarnaugh Map SimplificationCombinational Circuit DesignFlip-Flops and LatchesBinary Counters: Design and AnalysisBinary ArithmeticFixed-Point Number RepresentationTwo's Complement RepresentationOverflow and Underflow DetectionBinary Adders: Half-Adders and Full-AddersFull Adder and Carry PropagationCarry Lookahead Adder DesignHalf Adder Circuit DesignMultiplication Circuit DesignSequential Circuit DesignRegisters and Register FilesInstruction Set Architecture (ISA)Kernel Architecture and OS StructureSystem Calls and User/Kernel ModeProcesses and the Process Control BlockLogical Clocks and Event OrderingVector Clocks and Capturing CausalityHappened-Before Relation and Causal OrderingConsistency Models in Distributed SystemsRead-After-Write ConsistencySequential ConsistencyCausal ConsistencyStrong Eventual ConsistencyCRDTs: Conflict-Free Replicated Data Types

Longest path: 103 steps · 373 total prerequisite topics

Prerequisites (3)

Leads To (1)