We are asked to define "quorum" in a distributed system, explain how it is used to ensure consistency in a distributed data store, explain a simple quorum-based read/write protocol, and then answer a question about common configuration for write quorum W and read quorum R to guarantee strong consistency given N replicas, with the hint W+R > N, and the trade-off involved in choosing W and R sizes.
We need to produce a response. The user might be expecting a thorough answer, maybe with an example. Let's structure:
-
Definition: Quorum is the minimum number of replicas that must agree on an operation for it to be considered successful. In distributed systems, it's used to ensure consistency and availability. Typically, for a system with N replicas, a read quorum R and write quorum W are defined such that any read overlaps with some replica that has seen the latest write (i.e., R+W > N). This ensures that when reading, at least one replica that participated in the most recent write is included, thus returning the latest value.
-
Use in distributed data store: To maintain consistency, quorum protocols require that write operations be acknowledged by at least W replicas, and read operations be served by at least R replicas. The overlapping condition ensures that reads see the most recent write.
-
Simple quorum-based read/write protocol explanation: For a write, the client sends the write to all replicas; waits for acknowledgments from at least W replicas; if successful, the write is considered committed. For a read, client sends read request to all replicas; collects responses from at least R replicas; may need to resolve versions (e.g., timestamps) to return the latest value. Possibly use version vectors or timestamps. Or simpler: coordinator selects the most recent value among the R responses.
-
Common configuration: To guarantee strong consistency (i.e., linearizability or sequential consistency), we need that W + R > N. The typical choice is W = R = (N/2) + 1 (for odd N) or more generally, if N is odd, W = R = (N+1)/2. That ensures both quorums are majorities. Alternatively, sometimes W = N, R = 1 for write-all-read-one, but that's not using quorum? Actually write-all-read-one: write to all, read from any single node gives strong consistency if write is to all. That also satisfies W+R > N? With W=N and R=1, W+R = N+1 > N, yes. But typical "quorum" often refers to majority quorums. The question: "If you have N replicas, what is a common configuration for the write quorum W and the read quorum R to guarantee strong consistency? (Hint: W+R > N)" So we need to provide typical values, probably W = R = ceil(N/2)+1? Wait: For majority quorums, we need each quorum to be more than N/2. The smallest integers that satisfy W+R > N and also each individually > N/2? Actually the condition W+R > N is sufficient to guarantee overlap (if both quorums are chosen such that they intersect). However it's possible to have one quorum be small and the other large. But a common configuration is majority: W = R = floor(N/2)+1. For N=3, W=R=2. Then W+R=4>3. That's common. So answer: W = R = ⌊N/2⌋ + 1, i.e., majority.
Alternatively, sometimes they choose R=1 and W=N, but that's less common for quorum-based systems because writes become less available. The "common" might be majority. Provide both? But likely they want W = R = (N+1)/2 for odd N, and for even N maybe W = R = N/2 + 1. So we can say: typically, both W and R are set to a majority of replicas, i.e., W = R = ⌊N/2⌋ + 1.
- Trade-off: Increasing W makes writes slower (more acknowledgments needed) and less available; increasing R makes reads slower and less available. Also, higher W reduces write availability but ensures more durability (since more replicas have the data). Higher R improves read freshness but also increases latency and reduces read availability. There's a trade-off between consistency, availability, and latency. Also, there's a trade-off between read and write performance: If you increase W and decrease R (still satisfying W+R>N), writes become more expensive but reads become cheaper. Conversely, if you decrease W and increase R, writes faster but reads slower. The system designer chooses based on workload.
We'll produce a comprehensive answer. Possibly also mention that the simple protocol might use a single coordinator or might involve all nodes. Also mention that quorum is used in systems like Dynamo (with W+R > N) but that's eventual consistency; but for strong consistency, you need also that the coordinator reads from enough to determine the latest (maybe using timestamps). Actually the condition W+R>N ensures that at least one node in the read quorum has the latest write. However, if there are concurrent writes, you might need additional mechanisms like timestamps to resolve. But the question asks to explain a simple quorum-based read/write protocol. So we can outline: Client sends write to all replicas, waits for W acknowledgments. The write includes a timestamp. For reads, client reads from R replicas, returns the value with the highest timestamp among responses. Or if using a coordinator, the coordinator contacts R replicas and returns the most recent. This ensures that at least one of the R replicas has the latest write because W+R > N ensures overlap. So the read quorum will include at least one replica that participated in the write, so that replica's value is up-to-date (assuming timestamps monotonic). So the read returns the latest.
Now we should provide a detailed answer. Let's structure:
-
Definition: Quorum in distributed systems is the minimum number of nodes that must participate in an operation (read or write) for it to be considered successful. It's used to guarantee consistency across replicas.
-
Use: In distributed data stores, data is replicated across N nodes. To maintain consistency, we define two thresholds: write quorum W and read quorum R. A write is committed only when it is successfully stored on at least W nodes. A read is served by contacting at least R nodes and returning the most recent data among them. The condition W+R > N ensures that any read quorum intersects with any write quorum, so the read will always see at least one node with the most recent committed write, ensuring strong consistency.
-
Simple protocol: When a client writes data X: It sends X with a unique timestamp (or version) to all N replicas. Each replica stores X if the timestamp is newer than its current version. The client waits for acknowledgments from at least W replicas. If fewer than W respond, the write fails or is retried. For a read of X: The client sends read request to all replicas. It waits for responses from at least R replicas. Among the responses, it selects the one with the highest timestamp (or most recent version) and returns that value. Because W+R > N, there is at least one replica that has the write with the highest timestamp among the read responses, so the returned value is the latest.
-
Common configuration: To guarantee strong consistency, a typical configuration is to set both W and R to a majority of the replicas: W = R = ⌊N/2⌋ + 1. For example, if N=5, W=R=3.
-
Trade-off: The choice of W and R involves trade-offs. Larger W makes writes slower and less available (since they require more acknowledgments). Larger R makes reads slower and less available. Smaller W improves write latency and availability but might reduce durability (fewer copies). Smaller R improves read latency and availability but may risk returning stale data if not overlapping correctly? Actually if W+R > N, consistency is guaranteed, but if you reduce R too much, you might not have overlap? No, as long as condition holds, it's okay. But reducing R means reads contact fewer nodes, so you might read a stale node if the write hasn't reached those? Wait, if W+R > N, any set of R nodes must intersect with any set of W nodes? Actually the condition W+R > N ensures that any read quorum of size R and any write quorum of size W will have at least one node in common because if you take R nodes and W nodes, the total is > N, so they overlap. That ensures a read will always include at least one node that has the latest write, provided the write was successful. So consistency is guaranteed regardless of which specific nodes are contacted, as long as the read involves any R nodes. So you can have R=1 if W=N? But then W+R = N+1 > N, and read of one node will always be from the set of nodes that all have the write? Actually if W=N, all nodes have the write, so any read from any node sees latest. That's okay. So smaller R reduces latency. But the trade-off: If you set R very small, read operations become less robust to failures (since they need that many nodes to be up). Also, if you have a small R, you might not get the most recent value if you happen to read a node that hasn't received the write? But with the overlap guarantee, if W is large enough, the intersection property ensures that any set of R nodes includes at least one node that was in the write quorum. However, note: The write quorum is the set of nodes that acknowledged the write. The condition W+R > N ensures that any two sets of size W and R intersect. But a particular read might pick any R nodes; it might not include the node that was part of the write quorum? Actually the math: For any two subsets A (size W) and B (size R) of a universe of N, if |A|+|B| > N, then A∩B ≠ ∅. This is a combinatorial fact. So any write quorum A and any read quorum B must intersect. That means that no matter which nodes form the read quorum (any R nodes), they must intersect with the write quorum nodes. However, this is only true if we consider arbitrary sets of size exactly W and R. But in practice, the read quorum is a set of nodes that responded; it may be any R nodes among the N. The write quorum is the set of nodes that stored the write. Since W+R > N, any possible set of R nodes must include at least one node from the set of W nodes. That holds because the complement of the write quorum has size N-W. If we pick R nodes, by pigeonhole principle, if R > N-W, then we must pick at least one from the write quorum. So condition is R > N - W, equivalently W+R > N. So if W is large, N-W is small, so a small R could still satisfy R > N-W. For example, N=5, W=4, then N-W=1, so R > 1, i.e., R >=2. So R could be 2. That's still a small R. So the guarantee is that at least one node in the read set has the write. So consistency holds. However, there's a catch: The write quorum might not be static; it's the set of nodes that acknowledged that particular write. For a different write, the write quorum set may differ. But for any given write, the condition must hold for all reads after that write to see it. In the typical protocol, we require that the same condition holds for all reads and writes (W and R fixed). Then given any committed write (which was written to at least W nodes), any read that obtains responses from at least R nodes will intersect with those W nodes, thus see the write (assuming the nodes that are in the intersection have stored the write and are up to date). But there is nuance: if some nodes that were part of the write quorum are down or have stale data? Actually after a write is committed, the nodes that were part of the write quorum have stored the new value. If a read later includes one of those nodes, it will get the new value. However, if those nodes later fail or are partitioned, but the read only contacts nodes that are up and among them we need at least R nodes that are up. The condition ensures intersection with the write quorum set, but if the intersected node is down (i.e., not among the nodes that responded to the read), the read might not get that intersection. So we also need that the read quorum of size R consists of nodes that are up and responding. Typically, we assume at least N-W+1 nodes are up to satisfy R > N-W and we need enough nodes alive. The condition for safety is still W+R > N, but liveness requires that we have at least max(W, R) nodes available. The trade-off between availability and consistency: The larger the quorums, the more nodes need to be available, so lower availability. Also, with small W, writes can succeed even if many nodes are down, but then reads might not intersect if R is not large enough? Actually as long as the condition holds, intersection is guaranteed even if some nodes are down? Wait: The condition is about sets of size W and R; but if some nodes are down, the actual sets we obtain (the responding nodes) may be smaller than the quorum sizes. In practice, we wait until we get at least W acknowledgments for write, and at least R responses for read. If insufficient nodes respond, the operation fails. So the liveness condition requires that at least W nodes are up for writes and at least R nodes are up for reads. So if W and R are large, it's harder to have that many nodes up. So trade-off: larger W and R improve safety (consistency) but reduce availability. Smaller W and R improve availability but may compromise safety if the condition is not strictly enforced? Actually safety is guaranteed as long as W+R > N and we always wait for exactly W and R responses. Even if some nodes are down, we only count those that are up. But if we get exactly W responses for a write, those W nodes are up. For a later read, we need at least R up nodes. The intersection argument still holds because the write quorum set is a subset of the N nodes. For any set of R nodes that are up and respond, we need it to intersect with the write quorum. But if some nodes from the write quorum are down, they cannot be part of the read quorum. But the argument that any set of R nodes must intersect the write quorum assumes we are considering all N nodes, but we are only allowed to pick from the nodes that are up. If some nodes in the write quorum are down, the effective universe of nodes available for the read is smaller, and the intersection with the write quorum may not be guaranteed by the simple inequality alone because the write quorum set size might be larger than the number of up nodes? Actually the condition W+R > N guarantees that any two sets of size W and R chosen from the full set of N nodes intersect. However, if some nodes are down, the read quorum is chosen from a subset of the full set (the up nodes). The write quorum is a set of size W that may include down nodes? But the write quorum set is the set of nodes that replied to the write; those nodes were up at the time of write. They might later go down. So the write quorum set is a subset of the full N, of size W, and for a read we pick R nodes from the currently up nodes. Those up nodes could be a proper subset of N. The intersection of the write quorum set and the up nodes might be less than W if some nodes in the write quorum are down. But the read quorum is drawn from the up nodes only. The question is: is it possible that the read quorum (size R) chosen from the up nodes has no intersection with the write quorum? That would require that the write quorum and the up nodes are disjoint. But write quorum is a set of W nodes that were up at write time. If those nodes later go down, they could be down. The up nodes at read time might be a different set. For them to be disjoint, the up nodes must be a subset of the complement of the write quorum. That complement has size N-W. So if the number of up nodes at read time is > N-W, then by pigeonhole principle any set of up nodes of size > N-W must include at least one from the write quorum. But we are only picking R nodes from the up nodes. If the total number of up nodes is at least R, but we need to guarantee that any selection of R up nodes includes at least one from the write quorum. That's only true if the up nodes set is large enough and the write quorum is large enough relative to the up nodes. More precisely, if the number of up nodes is U, and the write quorum size is W, and we require that any subset of size R of the up nodes intersects the write quorum. This is guaranteed if R > U - (U - W)?? Actually the worst-case scenario for not intersecting is if the up nodes are entirely in the complement of the write quorum. The complement has size N-W. So if the up nodes are a subset of the complement, then we could have U up nodes all not in the write quorum. But if U <= N-W, it's possible that all up nodes are from the complement. But if U > N-W, then even if we try to pick up nodes all from the complement, we can't because the complement only has N-W nodes; there aren't enough up nodes to fill R? Wait: The condition for guaranteeing that any R-sized subset of up nodes intersects the write quorum is that the up nodes set cannot be entirely contained within the complement of the write quorum. But we cannot control which nodes are up; it depends on failures. The classic result: if we require that a read can succeed as long as there are at least R nodes up (and we can pick any R of them), then to guarantee intersection with any previous write quorum of size W, we need that the number of up nodes is at least R and also that R > N - W? Actually the intersection guarantee for arbitrary subsets of size R from the up nodes does not rely on the total up count; it's a property that if we pick R nodes from the entire set of N, we are guaranteed intersection. But if we are restricted to only up nodes, the guarantee might be lost if some of the nodes that would have been chosen are down, because we are effectively picking from a smaller pool. But the condition W+R > N is a sufficient condition for any two sets of size W and R from the full set to intersect. If we cannot choose from the full set because some nodes are down, then the read quorum we get is a subset of the full set, but we are not guaranteed that it will intersect the write quorum because the read quorum is chosen from the up nodes, not from all nodes. However, the protocol doesn't choose arbitrarily; we typically have a list of all replicas and we try to contact them; the ones that are up will respond. We then wait for R responses from any of the N nodes (but we only get responses from up nodes). The set of nodes from which we get responses is a subset of the up nodes. But we might not be able to contact any node that is down. So the actual read quorum set is not arbitrarily chosen from the full N; it's the set of nodes that respond. The safety requirement is that among the responses, there is at least one that has the latest write. The argument using W+R > N assumes that we could potentially get responses from any nodes; but if some nodes that are part of the write quorum are down, we won't get their response. However, we might still get a response from some other node that also got the write because the write quorum is of size W, but there could be more than W nodes that stored the write if the write propagated to more than the minimum required? In many protocols, the write is sent to all N nodes, and the ones that succeed (the write quorum) are those that respond; but the others may also eventually get it. But at the moment of the write, only W nodes need to have it. But it's possible that other nodes (outside the W) also have it if they responded after we already got W? Typically we stop waiting after W, but we might still send to all. In simple protocols, we often send to all and count the responses; but we might not know if the other nodes store it. However, for safety, we only rely on the fact that at least W nodes have it. For the read to see the write, we need at least one of the nodes in the read set to be among those W nodes. If some of those W nodes are down, they won't be in the read set. But if enough nodes are up and we get R responses, we need that among those responses there is at least one node from the write quorum. This is true if the number of nodes that are up and not in the write quorum is less than R, i.e., if R > (#up nodes not in write quorum). But we don't know which nodes are up. The worst case is that many nodes from the write quorum are down, leaving many others up. For consistency to be guaranteed, we need that even if all nodes not in the write quorum are up, and all nodes in the write quorum are down except maybe some, but we need that among the up nodes, the number of nodes that are NOT in the write quorum is at most R-1. Actually we need that in the set of nodes that can respond (the up nodes), there is at least one node from the write quorum. That is equivalent to: the number of up nodes that are not in the write quorum is less than the total up nodes, but we need at least one from write quorum alive. The worst-case scenario for violating this is if all nodes in the write quorum are down, and all up nodes are from the complement. The complement size is N-W. So if the number of up nodes > N-W, that would force at least one up node to be from the write quorum because there are only N-W nodes in the complement. However, if the number of up nodes is <= N-W, it's possible that all up nodes are from the complement. But we also require that we need to collect R responses. If the total number of up nodes is >= R, but if that number is <= N-W, it's possible that all up nodes are from the complement, meaning no node with the write is reachable. Then we cannot guarantee consistency. So safety (consistency) requires that we cannot have a situation where the read quorum of size R is satisfied by nodes that are all from the complement. But we don't control which nodes are up; if the failure pattern allows up nodes <= N-W, it's possible that all up nodes are from complement. However, the read operation will only succeed if we get at least R responses. If the number of up nodes is less than R, the read fails (unavailable). So for a read to succeed, we need at least R up nodes. If we have at least R up nodes, but the total number of up nodes is exactly R and they all happen to be in the complement (i.e., outside the write quorum), then we have R up nodes all without the write. But is that possible? The complement has N-W nodes. If R <= N-W, it's possible that we have exactly R up nodes all from the complement. In that case, the read would succeed but return stale data. However, does the condition W+R > N prevent R <= N-W? Because N-W = N - W. If W+R > N, then R > N-W. So R is strictly greater than N-W. Therefore, R > N-W. That means R is at least N-W+1. Therefore, the complement size N-W is strictly less than R. So if we have at least R up nodes, and the up nodes are some subset of N, can it be that all up nodes are in the complement? The complement only has N-W nodes. Since R > N-W, it's impossible for all R up nodes to be in the complement because the complement doesn't have enough nodes. Therefore, if we have at least R up nodes, we are guaranteed that at least one of them is from the write quorum. So the condition W+R > N ensures that as long as the read can get R responses (i.e., at least R nodes are up), those responses must include at least one node from the write quorum (since the write quorum has size W and the complement is smaller than R). This holds regardless of which nodes are up, because the only way to avoid having any node from the write quorum in the up set is to have all up nodes be from the complement, but that would require the number of up nodes ≤ N-W. Since we have at least R up nodes and R > N-W, it's impossible. So the guarantee holds even in the presence of failures, as long as the number of available (up) nodes is at least R. That's the classic argument in quorum systems: the condition W+R > N ensures that any successful read (which gets R responses) will intersect the write quorum of any committed write. So the combination of requiring R responses and the inequality ensures both liveness (provided enough nodes are up) and safety.
Thus the trade-off: Larger R requires more nodes to be up for reads to succeed, hence lower availability. Larger W requires more nodes to be up for writes to succeed. So there's a trade-off between performance (latency) and availability. The more you increase W, the slower writes, but reads could be faster if you keep R small. Conversely, the more you increase R, the slower reads. The sum condition must hold; you can adjust one while adjusting the other to maintain consistency. For read-heavy workloads, you might set R=1 and W=N (or W=N?), but W=N is very high availability cost for writes. For write-heavy, you might set W=1 and R=N? Actually if W=1, then for consistency you need R > N-1, i.e., R=N. That would be read-all-write-one; reads would need to contact all nodes, which is slow. So there's a trade-off.
But the question specifically: "what is the trade-off involved in choosing the sizes of W and R." So we should discuss the trade-off between read latency, write latency, and availability.
Also discuss the trade-off in terms of the number of nodes that must be contacted: increasing either increases latency but also increases the durability (more copies stored for writes) and ensures consistency under more failures? Actually durability is about not losing data; if you write to more nodes, you have more copies, so more tolerant to failures. But the immediate consistency guarantee doesn't depend on durability beyond the fact that the read must intersect. However, if a write is written to W nodes, but some of those nodes later fail permanently without replicating further, data could be lost if W is too small and those nodes are not recoverable. But that's more about replication factor and fault tolerance. The question focuses on "strong consistency" guarantee, but the trade-off might include performance and availability.
Let's write a comprehensive answer.
We'll also mention the concept of quorum in the context of Paxos, but it's similar.
We'll produce a final answer with sections.
Now, the user asks: "What is "quorum" in a distributed system? Please define quorum, how is it used to ensure consistency in a distributed data store, explain a simple quorum-based read/write protocol. If you have N replicas, what is a common configuration for the write quorum W and the read quorum R to guarantee strong consistency? (Hint: W+R > N), and what is the trade-off involved in choosing the sizes of W and R."
We must answer all parts.
We'll provide a definition: Quorum is the minimum number of nodes that must participate in an operation for it to be considered successful. In quorum-based replication, we define two thresholds: read quorum R and write quorum W. The system ensures that any read quorum overlaps with any write quorum, guaranteeing that reads always see at least one node with the most recent write.
We'll explain usage: For a data item, we have N replicas. To write, client must receive ack from W replicas. To read, client must query R replicas and take the most recent value (by version/timestamp). The condition W+R > N ensures overlap, thus strong consistency.
Now, simple protocol: We can describe either a direct client-to-replicas protocol or a coordinator-based. We'll give a simple one: For write, client sends write with timestamp to all replicas; each replica stores if timestamp > its current. Client waits for W acks. For read, client sends read to all; waits for R responses; picks the value with highest timestamp; returns it.
We might also mention that if replicas are ordered, the client could send write to a designated coordinator which forwards to all and counts acks, similarly for reads. But that's fine.
Now, common configuration: W = R = ⌊N/2⌋ + 1 (majority). Or we can say that a majority quorum is typical. Indeed, many systems like Dynamo use R+W > N, often with R=W=3 for N=5 (so majority). TorV, HBase uses majority for HDFS? Actually HDFS uses a write quorum of DataNode writes and a read quorum of 1? Not exactly. But typical.
Now trade-off: The choice of W and R involves trade-offs between read latency, write latency, and availability. Larger W increases write latency (more acks needed) and reduces write availability (since more nodes must be up). Smaller W does the opposite. Larger R increases read latency and reduces read availability. Smaller R reduces read latency but requires W to be larger to maintain W+R > N, which may increase write cost. So you balance based on workload: read-heavy workloads may choose larger W and smaller R; write-heavy may choose smaller W and larger R. Ultimately, you need W+R > N for strong consistency. Additionally, larger quorums improve durability (more copies) but also increase network traffic.
We can also mention that there is a trade-off with the fault tolerance: If you have up to f failures, you need N - f >= max(W,R) to be available, and also the quorum condition still holds with the remaining nodes? Actually after failures, the number of available nodes may drop below the required quorum, causing unavailability. So larger quorums require more nodes to be alive, making the system less tolerant to failures. That's part of the availability trade-off.
Now we should produce a final answer.
Let's plan a structure:
-
Introduction: definition of quorum.
-
How quorum ensures consistency: explain overlapping sets.
-
Simple quorum-based read/write protocol (step-by-step). Include handling of versioning.
-
Common configuration: W = R = majority.
-
Trade-offs: performance (latency), availability, durability, and load distribution.
Also note: In some systems, they use a coordinator that does the read repair, writes, etc. But we can keep it simple.
Let's write a response.
We'll ensure clarity and completeness.
We might also note that the condition W+R > N is necessary and sufficient for ensuring that there is at least one replica common to the read and write quorums. And that common replica will have the latest value if we use a monotonically increasing timestamp or version number.
We'll also mention that the system must resolve concurrent writes (e.g., last-write-wins based on timestamp). But we can keep it simple.
Now write the answer.
We'll produce a final output in a single coherent text.
Quorum in a distributed system is the minimum number of nodes (replicas) that must agree on an operation (read or write) for it to be considered successful. It is a fundamental concept in quorum-based replication used to maintain consistency and availability.
How Quorum Ensures Consistency
In a replicated data store with N replicas, we define two thresholds:
- Write quorum (W): The number of replicas that must acknowledge a write before it is considered committed.
- Read quorum (R): The number of replicas that must respond to a read request to produce a result.
The key property that guarantees strong consistency is the overlap between any read quorum and any write quorum. If every read intersects with at least one replica that has recorded the latest successful write, the read will return the most recent value. This overlap is mathematically ensured by the condition:
[
W + R > N
]
This inequality implies that any two sets of size W and R chosen from N elements must share at least one common element. Consequently, as long as a write has been stored on W replicas, any subsequent read that contacts R replicas will include at least one of those W replicas, provided enough replicas are up to satisfy the read quorum.
Simple Quorum-Based Read/Write Protocol
-
Write operation:
- The client generates a unique, monotonically increasing timestamp (or version number) for the update.
- The client sends the new value along with the timestamp to all N replicas (or through a coordinator that forwards to all).
- Each replica stores the value if the received timestamp is greater than its current version (otherwise it discards or keeps the newer one).
- The client waits for acknowledgments from at least W replicas. If fewer than W respond within a timeout, the write fails (or is retried).
-
Read operation:
- The client sends a read request to all N replicas (or a coordinator that queries all).
- The client waits for responses from at least R replicas.
- Among the received responses, the client selects the value with the highest timestamp (the most recent version) and returns it.
- (Optional: A read repair may be triggered to update any stale replicas that lag behind.)
Because of (W+R > N), at least one of the R responding replicas will have stored the latest write (the one with the highest timestamp among committed writes), ensuring the read reflects the most up-to-date state.
Common Quorum Configuration
A widely used configuration for strong consistency is to set both W and R to a majority of the replicas:
[
W = R = \left\lfloor \frac{N}{2} \right\rfloor + 1
]
For an odd N (e.g., 5), this gives (W=R=3). This majority choice satisfies (W+R > N) and provides good fault tolerance: the system can tolerate up to (\left\lfloor \frac{N-1}{2} \right\rfloor) simultaneous replica failures and still satisfy both quorums.
Other configurations are possible (e.g., (W=N, R=1) – write to all, read from any single node – also satisfies (W+R > N)), but majority quorums are the most typical because they balance read and write costs.
Trade-offs in Choosing W and R
The sizes of W and R involve inherent trade-offs:
-
Write latency vs. read latency:
Larger W means more replicas must acknowledge a write → higher write latency and more network overhead.
Larger R means more replicas must respond to a read → higher read latency.
By adjusting W and R (while keeping (W+R > N)), you can shift the cost toward either writes or reads based on workload.
-
Availability (fault tolerance):
A write succeeds only if at least W replicas are reachable; a read requires at least R reachable replicas.
Larger quorum sizes reduce the number of failures the system can tolerate before operations become unavailable. For example, with (W=R=3) in a 5‑node cluster, the system can lose at most two nodes and still serve both reads and writes. If you increase W to 4, the cluster could become unavailable for writes after two failures (since 4 nodes must be up).
Smaller quorums improve availability under failures but require the counterpart quorum to be larger (to keep (W+R > N)).
-
Durability:
A larger W means data is persisted on more replicas before the write returns, reducing the risk of data loss if some replicas fail permanently. Conversely, a small W leaves the data stored on fewer nodes, increasing the chance of loss if those nodes fail.
-
Load distribution:
Higher W increases write load on replicas (more messages/storage per write). Higher R increases read load. Balancing W and R can help distribute network and CPU usage according to the system’s read/write ratio.
In summary, the choice of W and R is a design decision that trades off performance, availability, durability, and load. The majority configuration (W=R=\lfloor N/2 \rfloor+1) is a common default because it offers a good, symmetric compromise for many systems.