R + W > N
Explore the R plus W greater than N principle in distributed data replication systems. Understand how quorum reads and writes work to ensure data durability and minimize stale reads. Learn about system availability trade-offs and common edge cases impacting data consistency in distributed architectures.
We'll cover the following...
Say we always read from r nodes and write to w nodes in a n node system then as long as the following inequality holds the writes to the system will be durable and the read from the system will return the latest value:
R + W > N
For our three node system, where N=3 we can choose R=1 and W=3. With these values we’ll write to all the nodes in the system and if any of the nodes is down then the write request will fail. Reading from any of the nodes in the system will naturally return the latest value since the write was recorded at all the nodes.
As a corollary of the above inequality we can further say:
If R < N then we can still process reads if a single node is down, e.g. N=3, R=1 and W=3. In fact, with this configuration we can tolerate upto two nodes being down for read queries. We can tolerate a ...