NoSQL · Data models beyond tables
How do consistency levels and replication interact in Cassandra?
Short answer
Cassandra's consistency level sets how many replicas must respond. With replication factor RF, a read quorum plus a write quorum greater than RF gives overlapping replicas and fresher reads.
The coordinator contacts the replicas that own the token and waits for the requested number of responses. Consistency is chosen per query, so the same table can serve both fast, stale-tolerant reads and slower, stronger reads.
CONSISTENCY LOCAL_QUORUM;
SELECT * FROM orders WHERE customer_id = 7f1c2a3e;
CONSISTENCY LOCAL_ONE;
SELECT * FROM product_cache WHERE product_id = 42;Levels and their trade-offs
- ONE: one replica, lowest latency, highest chance of stale data
- LOCAL_ONE: one replica in the local datacenter, useful for caches
- QUORUM: majority across all datacenters, stronger but pays cross-region latency
- LOCAL_QUORUM: majority within the local datacenter, the usual balance
- EACH_QUORUM: a quorum in each datacenter, stricter for multi-region writes
- ALL: every replica, highest consistency and least tolerant of failures
With RF=3 and LOCAL_QUORUM, two replicas must respond. If writes also use LOCAL_QUORUM, the write and read sets overlap within the datacenter. Cross-datacenter replication is asynchronous, so a LOCAL_QUORUM read in another region may not see the write until it replicates.
Follow-ups you should expect
Interviewers use these to check whether the first answer was understanding or memorisation.
- 1Why is QUORUM different from LOCAL_QUORUM in a multi-region cluster?
- 2What is the cost of a lightweight transaction?
- 3How does read repair affect consistency?
- 4What happens if too few replicas are available for the requested level?
Say it in the interview
Cassandra consistency level is per query and describes how many replicas must respond. With replication factor three, LOCAL_QUORUM requires two replicas in the local datacenter, so it tolerates one failure without cross-region latency. If writes and reads both use a quorum, their replica sets overlap. In multi-region clusters I am explicit about LOCAL_QUORUM versus QUORUM, because cross-region replication is asynchronous. Lightweight transactions use Paxos and SERIAL consistency, so I keep them off hot paths.
Use this as a model, not a script. Saying it in your own words is what makes it survive follow-up pressure.
Related questions
Reading is step one
Now say it out loud.
Understanding an answer and delivering it under pressure are different skills. Rehearse this topic in a live NoSQL mock interview and get scored feedback on depth, clarity and confidence.