Understanding the Quorum NWR Consistency Protocol Through an Alchemy Analogy
This article uses a mythological alchemy dialogue to illustrate distributed consistency concepts, mapping alchemical furnaces to server nodes and explaining the Quorum NWR protocol, its parameters N, W, R, and how they affect strong and eventual consistency in database systems.
“ Taibai Jinxing : I heard Lao Jun is practicing divine elixirs, can you tell me about it? “
“ Lao Jun : I am brewing six pills: two 延年丹 , two 健步丹 , and two 恢复丹 . “
“ Taibai Jinxing : Are the three alchemical furnaces dedicated to these three treasures? “
“ Lao Jun : Exactly, and the effect and size of each pill must be identical. “
1. Allocation of the Three Alchemical Furnaces
“
Taibai Jinxing : How are the furnaces allocated?
“
We reveal Lao Jun’s furnace allocation for the six pills.
It is easy to guess the original allocation:
Furnace 1 produces two 延年丹 .
Furnace 2 produces two 健步丹 .
Furnace 3 produces two 恢复丹 .
What problems arise with this allocation?
If furnace 1 overheats and explodes, both 延年丹 fail, similar to putting all eggs in one basket.
“
Lao Jun : Let me open the furnace lid for you.
“
Furnace 1 now produces one 延年丹 and one 健步丹 .
Furnace 2 produces one 延年丹 and one 恢复丹 .
Furnace 3 produces one 健步丹 and one 恢复丹 .
This distribution ensures that even if one furnace fails, at least one pill of each type can still be produced.
Mapping to internet systems, the furnaces correspond to server or database nodes, and multiple nodes provide high availability for the data.
2. Ensuring Identical Pill Quality
2.1 Consistency
“
Taibai Jinxing : You mentioned the two 延年丹 must have the same effect and size?
Lao Jun : Yes, the quality must be consistent; any difference leads to vastly different results.
“
This is exactly what we call distributed consistency : identical data across different nodes.
2.2 Eventual Consistency vs. Strong Consistency
In distributed systems, consistency is divided into eventual consistency and strong consistency .
Strong consistency (CP) guarantees that after a write completes, all subsequent reads see the updated value.
In the alchemy story, adding 莲花 to both furnaces’ 延年丹 yields identical composition, illustrating strong consistency.
Eventual consistency (AP) allows temporary divergence; after some time the values converge, similar to adding 莲花 to one furnace first and later to the other.
3. Controllable Quality: Quorum NWR Protocol
“
What if 延年丹 requires strong consistency while 健步丹 only needs eventual consistency?
“
The answer lies in the Quorum NWR protocol.
Quorum means the required number of participants; N, W, and R control consistency.
3.1 Parameter N
N is the replication factor, i.e., the number of copies of a datum. For 延年丹 , N = 2 (two furnaces hold a copy).
N can be changed: to have three copies, set N = 3; for a pill that only needs one copy, set N = 1.
3.2 Parameter W
W is the write consistency level: a write succeeds only after W replicas are updated.
Example: setting W = 2 for 延年丹 means the write is considered complete when two furnaces have been updated.
3.3 Parameter R
R is the read consistency level: a read returns the latest value after consulting R replicas.
Setting R = 2 for 延年丹 ensures that reading any two furnaces yields the most recent state, achieving strong consistency.
3.4 Parameter Combinations
Different N‑W‑R combos produce different consistency guarantees:
If W + R > N, the system provides strong consistency.
If W + R ≤ N, only eventual consistency is guaranteed.
Choosing the right values depends on the desired trade‑off between consistency, availability, and performance.
4. Application to InfluxDB Enterprise
InfluxDB Enterprise offers four write consistency levels:
any : W = 1, writes succeed on any node (or hinted‑handoff).
one : W = 1, writes succeed on a single node (no hinted‑handoff).
quorum : W + R > N, majority of nodes must acknowledge.
all : W = N, all nodes must acknowledge.
InfluxDB does not support read consistency (R = N) but can achieve strong consistency by using write level all .
5. Summary
This article uses the dialogue between Lao Jun and Taibai Jinxing to introduce a custom distributed consistency protocol, the Quorum NWR protocol.
Furnaces represent nodes; pills represent data; multiple pills are replicas.
N = number of replicas, W = number of replicas that must be written, R = number of replicas that must be read.
When N exceeds the number of nodes, a single node may hold multiple replicas, increasing failure impact.
W + R > N yields strong consistency; W = N favors read performance, R = N favors write performance.
W = R = (N+1)/2 provides good fault tolerance, tolerating up to (N‑1)/2 node failures.
Choosing N, W, R depends on system optimization goals.
Quorum NWR gives businesses flexible consistency choices, mitigating the weak consistency of pure AP systems.
“ Taibai Jinxing : I wish you success in alchemy! I’m off to share and leave a comment. “
Author Bio : Wu Kong, 8 years of front‑line internet development and architecture experience, uses stories to explain distributed systems and architecture. Author of “JVM Performance Optimization in Practice” and creator of the “Spring Cloud in Action” project.
Wukong Talks Architecture
Explaining distributed systems and architecture through stories. Author of the "JVM Performance Tuning in Practice" column, open-source author of "Spring Cloud in Practice PassJava", and independently developed a PMP practice quiz mini-program.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.