CRDTs (Conflict-Free Replicated Data Types)
Widely used in Google Docs or Figma or Redis to achieve eventually consistent model. The rules are
- Commutative: Order of the application doesn't matter
- Associative: Grouping of the operations doesn't matter
- Idempotent: Applying exact same thing multiple time does not change the effect
There are 2 types of CRDTs
- State-based CRDTs (CvRDTs): transmit the entire local state of data structure to other replica. However, this need a built-in merge function to combine its data with incoming data. Tolerate loss well consume lots of bandwidth
- Operation-based CRDTs (CmRDTs): broadcast specific operations (add 5, minus 5)