Cap Theorem hard
CRDTs ensure convergence (strong eventual consistency). But they fail to enforce 'Global Invariants'. Which is an example of a Global Invariant failure?
- A Two users edit the same document simultaneously, and the CRDT correctly preserves both sets of edits without any data loss.
- B A 'Counter' CRDT is able to accurately sum all +1 operations received from multiple geographic regions over a long period.
- C A bank account drops below zero because two different regions independently allowed a $100 withdrawal against a $150 balance.
- D A 'Set' CRDT that contains duplicate items which are resolved using a specialized deterministic tie-breaking algorithm.
Answer: C. A bank account drops below zero because two different regions independently allowed a $100 withdrawal against a $150 balance.
CRDTs (Conflict-free Replicated Data Types) ensure that divergent data states will eventually converge without conflict. However, they cannot enforce global rules (Invariants) like 'balance must be >= 0'. If two nodes independently process a withdrawal, they both see a sufficient balance and allow it. Only a CP system (using centralized locking or consensus) can prevent this specific state by forcing a global check before every write.
One system design question a day, with spaced repetition so the ones you miss come back.
Get the appRelated questions
- What is a 'Split Brain' scenario?
- The PACELC theorem extends CAP by stating: Even when there is NO partition (E), the system must choose between:
- Why is a CA (Consistent + Available) system generally considered impossible for distributed web applications?
- In CAP, 'Consistency' is equivalent to:
- In the CAP Theorem, what does the 'P' stand for?
- What causes a Network Partition?