---
title: "Eventual and tunable consistency in Cassandra"
subject: "Big Data Technologies"
chapter: 4
key: "semester_8/big_data_technologies:cassandra-eventual-tunable-consistency"
source: https://www.bctengineer.com/q/semester_8/big_data_technologies/cassandra-eventual-tunable-consistency
site: BCT Engineering
---

# Eventual and tunable consistency in Cassandra

Big Data Technologies · Chapter 4: NoSQL

- Asked in: 2073 Bhadra, 5 marks
- Video: [DataStax Cassandra Tutorials - Understanding data consistency in Cassandra](https://www.youtube.com/watch?v=hKLKpqY9UrY) — DataStax
- Answer checked by Claude Opus 5.5 (high effort) on 2026-10-14
- Page: https://www.bctengineer.com/q/semester_8/big_data_technologies/cassandra-eventual-tunable-consistency
- Whole chapter: https://www.bctengineer.com/md/semester_8/big_data_technologies/chapter-4

## Question

Explain eventual consistency and tunable consistency in context of Cassandra.

## Short answer

Cassandra provides eventual consistency, meaning all replicas eventually converge via hinted handoff, read repair, and anti-entropy, allowing momentary stale reads. Tunable consistency lets clients set per-operation consistency levels (e.g., ONE, QUORUM); strong consistency requires read_replicas + write_replicas > replication_factor.

## Answer

**Apache Cassandra** is a distributed, masterless, column-family NoSQL database. Data is replicated on several nodes (replication factor N). It is an AP system by default: it favours availability and partition tolerance, and gives consistency that is adjustable.

#### Eventual consistency

Eventual consistency means that if no new updates are made, all replicas of a data item will **eventually** become identical, though for a short time different replicas may return different values. A write is accepted by some replicas and propagated to the others in the background. Cassandra repairs differences using:

- **Hinted handoff:** if a replica is down, another node stores a hint and delivers the write when the replica returns.
- **Read repair:** during a read, if replicas return different values, the newest (by timestamp) is written to the stale ones.
- **Anti-entropy repair:** periodic comparison of replicas using Merkle trees.

This gives high availability and low latency, at the cost of possibly reading stale data for a brief time.

#### Tunable consistency

Cassandra lets the client choose, per read or write operation, how many replicas must respond before the operation is considered successful. This is the **consistency level (CL)**. The user trades consistency for availability and speed.

| Level | Meaning |
|---|---|
| ONE | One replica must acknowledge. Fastest, least consistent |
| QUORUM | Majority of replicas: floor(N/2)+1 |
| ALL | All replicas. Strongest, least available |
| LOCAL_QUORUM | Quorum within the local data center |
| ANY | (writes) even a hint is enough |

**Rule for strong consistency:** if `R + W > N` (R = replicas read, W = replicas written, N = replication factor), a read always sees the latest write.

Example: N = 3. Writing with QUORUM (W = 2) and reading with QUORUM (R = 2) gives 2 + 2 = 4 > 3, so reads are strongly consistent. Writing and reading with ONE (1 + 1 = 2 < 3) is fast but only eventually consistent.

```text
 Client --write(CL=QUORUM)--> Coordinator
        replicas: R1(ack) R2(ack) R3(later)
        success after 2 acks; R3 updated eventually
```

## Check yourself

The answer's key points as multiple-choice questions, with the correct option and why.

1. What does eventual consistency mean?
   A. Replicas are always identical
   B. Replicas never converge
   C. Writes are lost until repaired
   D. If no new updates occur, all replicas eventually become identical
   Answer: D. Replicas may briefly differ but converge once updates are propagated. (Key point: Eventual consistency)

2. What does read repair do?
   A. Writes the newest value (by timestamp) to stale replicas found during a read
   B. Deletes stale replicas
   C. Repairs the disk
   D. Restarts the node
   Answer: A. When replicas return different values on a read, the newest is pushed to the stale ones. (Key point: Read repair)

3. What condition gives strong consistency in Cassandra?
   A. R + W < N
   B. R + W > N
   C. R = 1 and W = 1
   D. N = 1 only
   Answer: B. If R + W > N the read and write replica sets overlap, so a read sees the latest write. (Key point: Strong consistency rule)

4. With N = 3, QUORUM writes and QUORUM reads give what?
   A. Eventual consistency only, since 2+2<3
   B. No consistency
   C. Strong consistency, since 2+2 = 4 > 3
   D. Strong consistency, since 1+1 = 2 > 3
   Answer: C. Quorum is floor(3/2)+1 = 2, so R + W = 4 > 3. (Key point: QUORUM calculation)
