Skip to main content
cd ../lexicon
sys/docs/lexicon/delta-state-crdt-anti-entropy.md
Lexicon

Delta State CRDT Anti-Entropy

Difficulty: Advanced
2 min read

In plain English

Plain definition

A way of syncing CRDT replicas by exchanging only the recent incremental changes (deltas) instead of the entire replica state on every sync round.

State-based CRDTs (CvRDTs) guarantee convergence by shipping the entire replica state and merging via a commutative, associative, idempotent join operation. This is simple to reason about but pathologically wasteful at scale: a gossip round for a 500MB CRDT means transmitting 500MB even if only a handful of elements changed. Delta State CRDTs (delta-CRDTs) close this gap by defining a delta-mutator: an operation that produces a small delta state d such that s' = s ⊔ d, where is the same join used for full-state merges. Replicas accumulate and buffer deltas locally, then propagate only those deltas during anti-entropy, falling back to full-state join only for bootstrapping new replicas or repairing after buffer eviction.

The core engineering challenge is delta buffer management. Each replica must track, per peer, which deltas have not yet been acknowledged, since deltas cannot simply be discarded after one send — gossip and epidemic dissemination assume lossy, unreliable, out-of-order delivery. Implementations typically maintain a causal context (a version vector or dot store) alongside each delta so that out-of-order or duplicate delta application remains idempotent, exploiting the same join semantics as the parent CRDT. Without bounding this buffer, delta CRDTs degrade toward full-state transmission anyway, since unacknowledged deltas accumulate; systems like AntidoteDB and the delta-crdts reference implementations use causal stability tracking to prune deltas once every replica has observed them.

Edge cases dominate production reasoning: delta redundancy (sending overlapping deltas across multiple gossip rounds) causes join operations to be applied multiple times, which is safe under idempotency but wastes CPU on merge overhead if the CRDT’s join is not O(1). Anti-entropy schedulers must also decide between delta-interval batching (coalescing many small deltas into one join before transmission, trading latency for bandwidth) versus per-mutation delta shipping (lower latency, higher message overhead). A common architectural failure is applying deltas without validating causal context, which silently reintroduces the exact staleness problems delta-CRDTs were designed to avoid — a replica can appear converged while missing causally-dependent deltas it never received due to a network partition, producing a stable but incorrect merged state until full-state repair triggers.

Delta-state anti-entropy sits architecturally between naive state-based CRDTs (bandwidth-heavy, operationally simple) and operation-based CRDTs (bandwidth-light, but requiring reliable causal-order delivery infrastructure like a total-order broadcast layer). It’s the pragmatic middle ground exploited by systems needing CRDT convergence guarantees over unreliable, high-fan-out gossip topologies — geo-replicated key-value stores, collaborative editing backends, and edge caches — where full-state transfer is untenable but building reliable exactly-once messaging for op-based CRDTs is architecturally excessive.