# Quorum

## What it is

A quorum is the number of members whose participation a distributed system
requires before it accepts a particular decision. In a majority-based system, a
group of five members can form a quorum with three. The group can keep making
the decisions that require a majority while two members are unavailable,
provided the remaining members can communicate and meet the protocol's other
conditions.

The overlap between majorities is important. Two sets of three chosen from the
same five have at least one member in common. A consensus protocol uses such
overlap together with an election rule, log rules and recorded state. That
combination gives the system a way to agree on a history even though individual
members may lose contact or restart. The number alone describes the
participation threshold. The protocol specifies who can vote, how members record
decisions and how they learn the most recent committed state.

Some systems use quorums for leader elections or committing log entries. Others
expose configurable participation requirements for reading and writing
replicated data. Identify the particular operation and guarantee before
comparing counts. A read using a local copy and a read that must confirm a
current leader can have different availability and freshness properties even in
the same deployment.

## Why it matters

Consider a five-member service divided by a network failure into groups of three
and two. The group of three can potentially continue making majority decisions.
The other group can have healthy processes and still lack enough members to do
so. An application needs to recognise the difference between a running machine
and an available decision-making service. A check that reaches one process might
give a green result while requests that need agreement are timing out.

Placement matters as much as membership count. Three members on a single host or
in a single failure domain can disappear together. The system might have five
total processes and still lose the ability to decide after one machine fails.
Choose where members run based on the failures the service is expected to
survive. Even sizing can also be surprising. Both three and four voting members
can tolerate one loss under majority rules, while adding a fifth to a healthy
four-member configuration changes the failure tolerance.

A quorum design should state what happens to users during loss of agreement. A
catalogue might show an explicitly stale copy for browsing, while operations
that change persistent state can wait or fail with a defined status. Decide
which paths require current decisions and what evidence the user receives if the
service cannot make one. Test that rule from the normal application entry point.

## What it looks like in practice

Create an illustrative five-member coordination service and take one member
offline during a workload. Check that new operations still complete, with
evidence that the service is recording the accepted history on a quorum. Take a
second member offline and repeat. Now isolate one of the remaining members from
the other two and verify that requests needing a majority reach the prescribed
unavailable outcome. Record what clients see, including retries and deadlines.

Try the same test with a partition that leaves a majority together while an
isolated member still has its local data. Probe both paths through the client
the application actually uses. A stale read can appear healthy if it returns
immediately from a local copy. The service should give that result a clear
meaning so a caller can choose between a permitted historical view and an
operation that needs confirmation of a current leader or another quorum.

Restore connectivity and observe how the members catch up. Verify that a client
can find a service instance able to answer the required kind of query. A rolling
deployment can use the same exercise before taking a host out for maintenance.
Count the available members and identify where they run. A healthy count with
every survivor in one remaining failure domain should influence whether another
planned change starts.

Engineer's
[backup and restore-test case study](/portfolio/backups-that-have-actually-been-restored/)
documents an automated workflow with distinct backup and restore signals and a
byte comparison for a known file. It provides a helpful model for evidence.
Replicated membership and recovery of a copy also need distinct checks. In this
example majority participation tells us whether current decisions can proceed. A
recovery exercise tells us what usable data can be recovered under a different
class of failure.

## Where it goes wrong

An operator can replace a voting member while the system is already close to
losing its majority. Changing which members count can raise the votes needed or
leave the group without enough participants to finish the change. Follow the
protocol's membership procedure and check its current availability before
scheduling another restart. Exercise configuration changes and actual node
failures separately.

A participant can also report success too early. If a system returns before an
operation reaches its required durable decision, a reconnect can reveal that the
client saw a tentative result. Examine what the product guarantees after
acknowledgement. Test a lost reply, a leader change and a recovered member. Give
users a way to distinguish a confirmed result from an uncertain outcome.

Lastly, design for total loss of the decision-making group. A forced recovery
with fewer surviving members can require a different procedure and may lose some
acknowledged or recent work depending on the system and its available records.
Document the data decisions and which person can authorise recovery. The regular
drill should leave a clear count of available voting members and a verified
operation. The recovery drill should establish the scope of data that can be
restored.

## Further reading

- [The Raft consensus paper](https://raft.github.io/raft.pdf). Defines election
  and replicated-log rules built around majority agreement.
- [The etcd FAQ](https://etcd.io/docs/v3.6/faq/). Explains majority sizing and
  membership trade-offs.
- [The etcd guide to failures](https://etcd.io/docs/v3.6/op-guide/failures/).
  Describes how failures change availability and recovery options.

<https://engineer.company/glossary/quorum/>
