Cap Theorem medium
In a distributed datastore with replication factor N=3, you require Strong Consistency. Which configuration of Write Quorum (W) and Read Quorum (R) satisfies this?
- A W=1, R=3 (Fast writes, but extremely slow reads that may still return stale data).
- B W=2, R=2 (Ensures overlap between the read and write sets since W + R > N).
- C W=3, R=0 (Writes to all nodes, but does not perform any validation during the read phase).
- D W=1, R=1 (Optimized for maximum performance with minimum network coordination overhead).
Answer: B. W=2, R=2 (Ensures overlap between the read and write sets since W + R > N).
To guarantee Strong Consistency in a distributed system, the sets of nodes used for reading and writing must overlap. Mathematically, this is expressed as W + R > N. With N=3 replicas, a configuration of W=2 and R=2 ensures that at least one of the nodes queried during a read will have received the most recent successful write, preventing stale data from being served. In contrast, W=1 and R=1 only provide Eventual Consistency and prioritize low latency.
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?