System Design#A2: Quorum and data consistency’s tradeoffs

Anshumaan Tiwari
Javarevisited
Published in
2 min readDec 30, 2023

In causal consistency when we use aggregation operations like Sum(all) then a huge inconsistency can occur in the system.

The execution order should be:

Sum(all)

Write(1,10)

Sum(all)

Write(2,20)

Sum(all)

Think in thread 1:

Sum(all)

Sum(all)

Sum(all)

And in thread 2

Write(1,10)

Write(2,20)

Now we can see even after separating both execution statement in different thread there a some sort of dependency exist in both the execution statements of threads. Imagine if thread 2 is executed first then thread 1 then sum we will get will be wrong hence inconsistency I the database.

To improve this quorum is introduced:

Let’s break down the concept of quorum in system design with a simple step-by-step explanation and example:

Introduction to Quorum:

Quorum in system design is like a voting system for nodes in a distributed environment. It ensures that a minimum number of nodes or threads need to agree on an operation for it to be considered successful.

Example Scenario:

Imagine a database distributed across three nodes (Node A, Node B, Node C), and we want to update a piece of data.

Quorum Size:

Let’s set our quorum size to two. This means we need agreement from at least two out of the three nodes for the operation to succeed.

Read Operation:

For a read operation, if a user wants to retrieve data, the system might consult any two out of the three nodes. As long as there’s agreement among the two nodes, the read is considered successful.

Write Operation:

For a write operation (update or insert), the system requires agreement from at least two nodes. If two nodes confirm the update, it’s considered successful.

Fault Tolerance:

Quorum provides fault tolerance. Even if one node is temporarily unavailable or fails, the system can still function as long as the remaining nodes achieve the quorum.

Example in Action:

Suppose Node A and Node B agree on an update, but Node C is temporarily offline. The quorum (two out of three) is still reached, and the update is successful.

In summary, quorum ensures that a distributed system can operate with a level of agreement among nodes, providing fault tolerance and maintaining consistency even in the face of network issues or node failures. It’s like having a reliable vote count to make decisions in a distributed environment.

Data consistency’s tradeoffs

Problems

If there are only 2 data replica then brain drain problem can occur

If there is only one data replica then single point of failure can occur

--

--

Anshumaan Tiwari
Javarevisited

Software Developer having a little passion for technical content writing