← Lessons

quiz vs the machine

Gold1440

Databases

Cassandra Tunable Consistency

Pick how many replicas must respond per request to trade latency for safety.

5 min read · core · beat Gold to climb

Consistency as a Dial

Cassandra replicates each row to several nodes set by the replication factor. For each read or write you choose a consistency level, the number of replicas that must respond before the operation succeeds. This lets you tune per request rather than per cluster.

Common Levels

  • ONE waits for a single replica, giving the lowest latency but the weakest guarantee.
  • QUORUM waits for a majority of replicas.
  • ALL waits for every replica, the strongest but most fragile.

The Quorum Overlap Rule

If the read level plus the write level exceeds the replication factor, then read and write replica sets always overlap by at least one node. That overlapping replica is guaranteed to hold the latest write, so the read sees it. This is the basis for strong consistency on a leaderless system.

Trade Off

Higher levels mean more nodes must be reachable, so availability drops if nodes fail. Lower levels stay available but may return stale data.

Key idea

Cassandra lets each request set how many replicas must respond, and choosing read and write levels that together exceed the replication factor gives strong consistency on a leaderless cluster.

Check yourself

Answer to earn rating on the learn ladder.

1. What does a consistency level specify in Cassandra?

2. When are read and write replica sets guaranteed to overlap?

3. What is the cost of choosing higher consistency levels?