← Lessons

quiz vs the machine

Gold1460

Databases

Tunable Consistency Levels

By choosing how many replicas must answer, you trade consistency against latency on a per request basis.

5 min read · core · beat Gold to climb

Consistency as a Dial

Some distributed stores let you choose, per operation, how many replicas must confirm a read or write. With N replicas holding each key, you pick a write count W and a read count R. This makes consistency a dial rather than a fixed property.

The Quorum Rule

  • If W plus R is greater than N, the read set and the write set must overlap on at least one replica, so a read is guaranteed to see the latest acknowledged write. This is a quorum.
  • Choosing high W and R favors consistency at the cost of latency and availability.
  • Choosing low W and R favors speed and availability at the cost of possible staleness.

Common Settings

  • A read and write both requiring a majority gives strong guarantees.
  • W equal to one means a write returns after a single replica acknowledges, which is fast but risky.
  • R equal to one returns from the first replica to answer, which may be stale.

Why This Helps

Different operations have different needs. A financial update can demand a quorum while a view counter can accept a fast loose read, all in the same database.

Key idea

Tunable consistency lets each request pick how many replicas must respond, and when W plus R exceeds N a quorum guarantees reads see the latest write.

Check yourself

Answer to earn rating on the learn ladder.

1. When does a quorum guarantee a read sees the latest acknowledged write?

2. What does choosing low W and R favor?