How do Reading and Writing Quorums work?
  • To start, lets consider the write to be successful when it is only processed by only 2 of the 3 replicas ✅
    • What if 1 of the 3 replicas accepted the write… How far can we push this 🤔
    • If we know every write guaranteed out of 2 of the replicas that means 1 replica could be stale 😵
  • Therefore, if we read from at least 2 replicas at least we know that 1 replica of the two is update to date 💡
    • If the 3rd replica is down or slow to repond
      • Reads can continue returning up to date values

Illustrate the Quorum Variables

  • W = Minimum write nodes ✍️
  • R = Minimum read nodes 📖
  • N = Nodes in the quorum group 📚

Summary of Quorum

  • More generally if there are N replicas 📚
  • Every write must be confirmed by W nodes ✍️ to be considered successful.
  • We must query R nodes 📖 for each query
    • Because at least R nodes 📖 will be at least up to date

Reads and writes that obey this R 📖 and W ✍️ values are called Quorum reads and writes.

  • You can think R 📖 and W ✍️ as the minimum number of votes for the read to be valid.

In a Dynamo style databases:

  • The parameters N 📚, W ✍️ and R 📖 are typically configurable
  • Note, there maybe more than N 📚 nodes in a cluster
    • But any given value will be stored only on N 📚 nodes
    • This allows for data sets to be partitioned
      • Supporting data sets that are larger that can fit on 1 node

The Quorum Condition (W+R) > N

The (W+R) > N allows us to tolerate theses nodes with these types of stipulations:

  • If W < N we can still process writes if a node is unavailable
  • If R < N we can still process we can still process reads if a node is unavailable

For example:

  • 📚 N = 3
  • ✍️ W = 2
  • 📖 R = 2
  • We can tolerate one unavailable node

Similarly:

  • 📚 = 5
  • ✍️ W = 3
  • 📖 R = 3
  • We can tolerate 2 unavailable nodes

Normally reads and writes are always to all N 📚 replicas in parallel.

👉 Tip: The parameters N and R determine how many node we wait for…

  • That is how many of the N nodes needed to report success before we consider the read and write to be successful.

👉 Tip: If there are fewer W or R nodes are available writes will return errors

  • Nodes can be unavailable for many reasons
    • Node down
    • Crashing
    • Powering down
    • Error in an operation
      • Inability to write as the disc is full
    • Due to a network interruption between the client and the node
    • Etc..
  • We only care if whether the node returns a successful response
    • And we do not need to distinguish between different kinds of faults

📚 Further Reading & Related Topics

If you’re exploring quorum-based reading and writing in distributed systems, these related articles will provide deeper insights:

• Distributed Data-Intensive Systems: Limitations of Quorum Consistency – Understand the trade-offs and challenges of quorum consistency in distributed databases.

• Resolving Write Conflicts in Distributed Data-Intensive Systems – Learn how distributed systems handle write conflicts, an important aspect of quorum-based replication.

5 responses to “How do Reading and Writing Quorums work?”

  1. Distributed Data Intensive Systems: Sloppy Quorums and Hinted Handoffs? – Scalable Human Avatar

    […] this means even if W + R > N, you cannot be sure to read the latest value for a […]

    Like

  2. Distributed databases – Is Performance, Scalability and Transactional Guarantees Achievable? – Scalable Human Blog Avatar

    […] • Distributed Data-Intensive Systems: Reading and Writing Quorums – Understand how quorum-based approaches impact data consistency, availability, and scalability in distributed databases. […]

    Like

  3. What is a Conflict in Replication? – Scalable Human Blog Avatar

    […] • Distributed Data-Intensive Systems: Reading and Writing Quorums – Understand how quorum-based approaches affect conflict resolution and data integrity. […]

    Like

  4. Understanding the “Happens-Before” Relationship in Distributed Systems – Scalable Human Blog Avatar

    […] • Distributed Data-Intensive Systems: Reading and Writing Quorums – Explore how quorum-based approaches influence consistency and ordering in distributed environments. […]

    Like

  5. What is Multi-Leader Replication? – Scalable Human Blog Avatar

    […] • Distributed Data-Intensive Systems: Reading and Writing Quorums – Explore how quorum-based replication strategies work alongside multi-leader replication to maintain consistency and availability in distributed systems. […]

    Like

Leave a reply to Distributed databases – Is Performance, Scalability and Transactional Guarantees Achievable? – Scalable Human Blog Cancel reply

I’m Sean

Welcome to the Scalable Human blog. Just a software engineer writing about algo trading, AI, and books. I learn in public, use AI tools extensively, and share what works. Educational purposes only – not financial advice.

Let’s connect