Comparison between strict and sloppy quorum

Migo·2025년 1월 6일
0

Distributed system

목록 보기
10/12
post-thumbnail

Quorum is quite a well-known concept that allows for tunable consistency. But then, it is also weak at (mostly) inter-datacenter partition.

Imagine you have distributed system with replication factor of 5, and you have 3 replicas in datacenter A and 2 in datacenter B. What if parition occurs as follows?:

Turns out there is no easy solution. You just need to hope that the server is connecting to the cluster where quorum is met, namely A in this case.

Strict Quorum

  • Assume that replication factor N = 5
  • To make it R + W > N, let's give W = 3 and R = 3.

When you go for strict quorum, it just fails if required quorum is not achieved.

Sloppy Quorum and hinted handoff

  • Given the same replication factor N = 5
    • We have preferred replicas that is just enough to meet quorum. Let's call it preferred replicas, which is 3 in this case.
    • We have 2 secondary replicas that kinds of stand by.

Essentially, all write and read requests go to preferred replicas.

If one of the preferred replica goes down, however, it sends the request to secondary replica:

Cluster manager then, when failed node(R3) comes back, let the node(R4) which has received data on behalf transfer the values back to now resurrected node.

This tranferring process is called Hinted Handoff.

Comparison

Now, with the same number of nodes and quorum requirements, let's compare strict and sloppy quorums.

  • Availability

    • Strict - Lower due to strict requirements. Write fails if fewer than W nodes are available.
    • Sloppy - Higher availability due to fallback to secondary replicas.
  • Consistenty

    • Strict - Stronger as every replicas participate as primary replicas
    • Sloppy - In the period where secondary nodes are holding the data and not yet transfer to the original node, if read request comes in, and preferred node with updated data goes down. Then the system may end up returning stale data.
  • Performance

    • Strict : lower
    • Sloppy : better
  • Complexity

    • Strict : simpler
    • Sloppy : higeher due to the need for fallback mechanism(e.g., hinted hadoff)

Questions

  • What enables automatically choosing preferred replicas?
    • Perhaps, phi-accural could be applied.
    • Spanning Tree is also a good option that could represent the most efficient, uni-directed graph.
profile
Dude with existential crisis

0개의 댓글