What are CRDTs and how can they help in distributed microservices state?

Answer

CRDTs (Conflict-free Replicated Data Types) are data structures designed to be replicated across multiple nodes and merged automatically without conflicts, guaranteeing eventual consistency by mathematical construction. Because all concurrent updates to a CRDT can be merged deterministically — regardless of order — they eliminate the need for coordination or conflict resolution logic. Examples: a G-Counter (grow-only counter, used for view counts) merges by taking the max of each node's value; an LWW-Register (Last-Write-Wins Register) uses timestamps; an OR-Set (Observed-Remove Set) supports add and remove operations. CRDTs are used in databases like Riak, Redis (CRDT data types in Redis Enterprise), and real-time collaborative apps like Figma. In microservices, CRDTs are valuable for high-availability counters, shopping carts, and collaborative features where distributed writes must converge without coordination.