liveBook · Manning

Tunable consistency

As explained in ScyllaDB in Action

Tunable consistency is a database mechanism that lets clients select the consistency level required for individual operations.

Tunable consistency lets each ScyllaDB query choose how many nodes must acknowledge it before it succeeds. The choice trades availability against the chance of reading data that has not yet converged across replicas. section 1.2.1 section 8.2.2

At one extreme, ALL requires every replica and fails if any replica is unavailable. ONE needs one replica, so queries can continue through more failures but can return inconsistent data. QUORUM is the middle ground: a majority of replicas must respond; with three replicas, that means two and tolerates one failure. section 1.2.1 section 8.2.2

Table 8.1 Scylla supports many consistency-level choices for your queries to balance consistency and availability.
Consistency level
Required nodes to respond
ANY
Any node in the cluster can respond, even if it’s not a replica
ONE
A single replica
LOCAL_ONE
A single replica in the same datacenter
TWO
Two replicas
THREE
Three replicas
QUORUM
A majority of replicas
LOCAL_QUORUM
A majority of replicas in the same datacenter
EACH_QUORUM
A majority of replicas in every datacenter
SERIAL (used to get the latest data via Paxos)
A majority of replicas
LOCAL_SERIAL
A majority of replicas in the same datacenter
ALL
Every replica in the cluster

Compare the available levels by required responders. Datacenter-aware choices narrow acknowledgments to local or each datacenter, while SERIAL uses Paxos to obtain the latest value. section 8.2.2

Weaker levels favor serving traffic during failures, but a replica may not have seen a previous write. Using QUORUM for both reads and writes prevents stale reads. SERIAL provides linearizable reads by ordering them to reflect real-life ordering. section 8.2.2 section 8.2.2

ANY is more permissive than ONE: if replicas are unavailable, a nonreplica can acknowledge a write. The coordinator keeps that write locally and later sends it to the unavailable node through hinted handoff. section 8.2.2

This flexibility supports ScyllaDB’s availability-oriented query path. Unlike CP distributed relational databases that lose availability without a quorum, weaker levels such as ONE can preserve functionality during greater loss of availability. section 1.2.5 section 1.2.6

How ScyllaDB in Action covers it

How deep it goes
Defines acknowledgment levels and their failure and stale-read effects, while deferring detailed hinted handoff treatment.
Examples
Compares ALL, QUORUM, and ONE with a three-replica cluster and illustrates stale and ordered reads.
What you can do after
Apply it via ScyllaDB query consistency levels to choose required responders and failure tolerance.
How it connects
Connects eventual consistency, replication factor, quorum, CAP theorem, hinted handoff, Paxos, and linearizability.

Related concepts

This explainer was generated by Manning's knowledge graph from the text of ScyllaDB in Action. The section links point to the parts of the book it draws on.