Cassandra Consistency Levels Interview Questions
Master Apache Cassandra Consistency Levels with interview questions covering Eventual Consistency, Strong Consistency, ONE, QUORUM, ALL, LOCAL_QUORUM, EACH_QUORUM, ANY, SERIAL, LOCAL_SERIAL, Read/Write Consistency, and production best practices.
Introduction
One of Cassandra's most powerful features is Tunable Consistency.
Unlike traditional databases that always provide strong consistency, Cassandra allows developers to choose the consistency level for each read and write operation.
This flexibility enables applications to balance:
- Availability
- Performance
- Latency
- Data Consistency
Understanding consistency levels is one of the most frequently asked Cassandra interview topics for Backend Engineers, Solution Architects, and Database Engineers.
Cassandra Replication Architecture
flowchart LR
Client --> Coordinator
Coordinator --> Replica1
Coordinator --> Replica2
Coordinator --> Replica3
Replication Factor = 3
1. What is Consistency in Cassandra?
Answer
Consistency determines how many replica nodes must acknowledge a read or write operation before Cassandra considers it successful.
Unlike relational databases, Cassandra allows the application to choose the required consistency level.
2. What is Tunable Consistency?
Tunable Consistency allows developers to configure consistency per query.
Example
- Strong Consistency
- Eventual Consistency
- Low Latency Reads
- Highly Durable Writes
3. What is Eventual Consistency?
Eventual Consistency means all replicas will eventually contain the same data.
Immediately after a write
Replica 1
Updated
Replica 2
Pending
Replica 3
Pending
After synchronization
Replica1
Replica2
Replica3
All Same
4. What is Strong Consistency?
Strong Consistency guarantees the latest write is returned.
Formula
Read Consistency
+
Write Consistency
>
Replication Factor
Strong Consistency
flowchart LR
Write --> Replica1
Write --> Replica2
Write --> Replica3
Read --> LatestValue
5. What is Replication Factor (RF)?
Replication Factor defines how many copies of data Cassandra stores.
Example
RF = 3
Replica1
Replica2
Replica3
6. What are Cassandra Consistency Levels?
Write Consistency Levels
- ANY
- ONE
- TWO
- THREE
- QUORUM
- ALL
- LOCAL_QUORUM
- EACH_QUORUM
- LOCAL_ONE
Read Consistency Levels
- ONE
- TWO
- THREE
- QUORUM
- ALL
- LOCAL_QUORUM
- LOCAL_ONE
- SERIAL
- LOCAL_SERIAL
7. Explain Consistency Level ONE.
Write succeeds after
1 Replica
acknowledges.
Advantages
- Fast
- Low Latency
Disadvantages
- Eventual Consistency
ONE Example
flowchart LR
Coordinator --> Replica1
Coordinator
-.->Replica2
Coordinator
-.->Replica3
8. Explain TWO.
Two replicas must acknowledge.
Higher consistency than ONE.
9. Explain THREE.
Three replicas acknowledge.
Usually used when RF ≥ 3.
10. Explain QUORUM.
Formula
(RF / 2)
+
1
Example
RF = 3
2 Replicas
must respond.
QUORUM Example
flowchart LR
Coordinator --> Replica1
Coordinator --> Replica2
Coordinator
-.->Replica3
11. Explain LOCAL_QUORUM.
Only replicas within the local data center participate.
Ideal for
- Multi-DC Applications
- Low Latency
12. Explain EACH_QUORUM.
Requires quorum from every data center.
Example
US-East
↓
2 Nodes
Europe
↓
2 Nodes
Used rarely due to higher latency.
13. Explain ALL.
All replicas must acknowledge.
Advantages
- Highest Consistency
Disadvantages
- Slow
- Less Available
14. Explain ANY.
ANY requires only one acknowledgment.
The acknowledgment may come from:
- Replica
- Hint Handoff
Fastest write consistency.
15. Explain LOCAL_ONE.
Only one replica from the local data center responds.
Useful for
- Multi-Region Applications
- Low Latency
16. What is SERIAL?
Used for
Lightweight Transactions (LWT)
Implements Paxos protocol.
Example
INSERT ...
IF NOT EXISTS
17. What is LOCAL_SERIAL?
Same as SERIAL
Only within the local data center.
18. Difference between QUORUM and LOCAL_QUORUM?
| QUORUM | LOCAL_QUORUM |
|---|---|
| All Data Centers | Local DC Only |
| Higher Latency | Lower Latency |
| Cross-DC | Local Reads/Writes |
19. Difference between ONE and QUORUM?
| ONE | QUORUM |
|---|---|
| Faster | More Consistent |
| Lower Latency | Slightly Higher Latency |
| Eventual Consistency | Stronger Consistency |
20. Difference between QUORUM and ALL?
| QUORUM | ALL |
|---|---|
| Majority | Every Replica |
| Better Availability | Lower Availability |
| Faster | Slowest |
21. Explain Read Consistency.
Read Consistency determines
How many replicas must respond before returning data.
22. Explain Write Consistency.
Write Consistency determines
How many replicas acknowledge before write success.
23. Explain the Strong Consistency Formula.
Formula
Read CL
+
Write CL
>
Replication Factor
Example
RF = 3
Write QUORUM = 2
Read QUORUM = 2
2 + 2 > 3
Strong Consistency
24. Why does QUORUM provide strong consistency?
Because majority replicas participate.
Latest write is guaranteed.
25. What happens if one replica is unavailable?
Depends on consistency level.
Example
RF = 3
ONE
↓
Still succeeds
ALL
↓
Fails
26. Which consistency level is fastest?
ANY
↓
ONE
↓
LOCAL_ONE
27. Which consistency level is safest?
ALL
Highest consistency.
28. Which consistency level is most commonly used?
Most enterprise applications use
LOCAL_QUORUM
because it balances
- Performance
- Availability
- Consistency
29. What consistency level does Netflix commonly prefer?
Generally
LOCAL_QUORUM
Reason
- Multi-Region
- High Availability
- Strong Local Consistency
30. Real Production Example
Banking Application
Replication Factor
3
Transaction Write
LOCAL_QUORUM
Transaction Read
LOCAL_QUORUM
Benefits
- Strong Consistency
- Low Latency
- Multi-DC Support
Consistency Flow
flowchart LR
Client --> Coordinator --> Replicas --> ConsistencyCheck --> Response
Enterprise Best Practices
- Use RF = 3 for production.
- Prefer LOCAL_QUORUM in multi-data-center environments.
- Avoid ALL unless absolutely necessary.
- Use ONE for analytics or less critical data.
- Use SERIAL only for lightweight transactions.
- Monitor replica latency.
- Keep clocks synchronized across nodes.
- Schedule regular repairs to reduce inconsistencies.
- Test consistency settings under failure scenarios.
Quick Revision
| Consistency Level | Description |
|---|---|
| ANY | Fastest Write |
| ONE | One Replica |
| TWO | Two Replicas |
| THREE | Three Replicas |
| QUORUM | Majority |
| LOCAL_QUORUM | Majority in Local DC |
| EACH_QUORUM | Majority in Every DC |
| ALL | Every Replica |
| LOCAL_ONE | One Replica in Local DC |
| SERIAL | LWT Consistency |
| LOCAL_SERIAL | Local LWT |
Interview Tips
Interviewers commonly ask
- What is Tunable Consistency?
- Explain QUORUM.
- Explain LOCAL_QUORUM.
- Difference between ONE and QUORUM.
- Explain Strong Consistency Formula.
- Which consistency level would you choose for banking?
- Which consistency level provides the fastest writes?
- What happens when a replica is down?
- Explain SERIAL consistency.
- Why doesn't Cassandra always use strong consistency?
Always explain the trade-off between Consistency, Availability, and Latency, and justify your consistency level based on the application's business requirements.
Summary
Cassandra's tunable consistency model gives applications the flexibility to choose the appropriate balance between consistency, availability, and performance. By selecting consistency levels such as ONE, QUORUM, LOCAL_QUORUM, or ALL, developers can optimize their systems for different workloads and failure scenarios.
Understanding replication factor, read and write consistency, the strong consistency formula, and the behavior of each consistency level is essential for designing reliable, scalable, and highly available Cassandra deployments in enterprise environments.