educative.io

Educative

The larger value of r, the increasing of availability

Hi,
I don’t understand why it says “the larger value of r, we focus more on availability and compromise consistency”. Does it mean when r increase, the availability increase? If so, why is that?
As in the lecture, when a read request is issue, it will get data from r coordinates before returning the result to the client. If one of the r coordinates fails, Does it wait for that coordinate to recover to get data from that node return the result?


Course: Grokking Modern System Design Interview for Engineers & Managers - Learn Interactively
Lesson: Versioning Data and Achieving Configurability - Grokking Modern System Design Interview for Engineers & Managers

3 Likes

Hi @Phong_Hua if a node is down, the system uses a quorum-based approach to handle it. You can read it in more detail in the next lesson to this named as Enable Fault Tolerance and Failure Detection. Thank you!

1 Like

I think this part is wrong. For the r and w values, wouldn’t a larger value of r be more consistency over availability?

5 Likes

I asked chatGPT and it said this:

You are correct. In the context of distributed systems, specifically for read and write operations, ‘r’ represents the number of replicas that must respond to a read request, and ‘w’ represents the number of replicas that must acknowledge a write request.

When we have a larger value of ‘r’, it means more replicas must respond to a read request before the client receives a response. This ensures that the read operation is more likely to return the most up-to-date version of the data, leading to stronger consistency. However, this comes at the cost of lower availability, as it takes more time for the system to gather responses from the required number of replicas.

On the other hand, a smaller value of ‘r’ makes the system more available, as it requires fewer replicas to respond to a read request. This speeds up read operations but can potentially return stale data, leading to weaker consistency.

In summary, a larger value of ‘r’ indeed promotes consistency over availability in distributed systems. It’s essential to balance these trade-offs according to the specific requirements of the system and the desired consistency guarantees.

3 Likes