Intermediate LevelSystem Design & Architecture
What are Quorum Reads and Writes ($R + W > N$) in distributed databases?
β Interview Prompt: Explain Quorum Consistency in Cassandra/DynamoDB, Replication Factor ($N$), Read Quorum ($R$), Write Quorum ($W$), and Strong Consistency formulas.
In distributed masterless databases (Cassandra), consistency is tunable using Quorum Reads and Writes:
Quorum Formula:
β’
$N$: Replication Factor (Total node copies).
β’
$W$: Write Quorum (Number of nodes that must acknowledge a write).
β’
$R$: Read Quorum (Number of nodes responding to a read).
β’
Strong Consistency Condition: If $R + W > N$, the read and write quorums overlap on at least 1 node, guaranteeing the client always reads the latest written value!
Code Implementation Example
sql
-- Executing Quorum Read in Cassandra CQL
CONSISTENCY QUORUM;
SELECT * FROM user_profiles WHERE id = 'user_100';π‘Setting QUORUM consistency level in Cassandra.
π― Interview Key Takeaway
Configure R + W > N in distributed databases to achieve Strong Consistency across quorum node overlaps.
#System Design#Quorum#Cassandra#Consistency#Intermediate
Back to all System Design & Architecture Questionsβ