Database / Apache Cassandra Intermediate and Advanced interview questions
How does Cassandra achieve tunable consistency?
Cassandra lets you pick a consistency level (CL) independently for every read and every write, instead of hard-coding one global guarantee. The CL just says how many replicas out of the replication factor (N) must acknowledge before the coordinator replies to the client.
- Writes go to all N replicas in parallel, but the coordinator only waits for the CL you asked for (e.g. ONE, QUORUM, ALL).
- Reads query enough replicas to satisfy the CL, then compare timestamps and pick the freshest value.
- If R + W > N (read replicas + write replicas exceeds replication factor), you get strong consistency because the read and write sets are guaranteed to overlap by at least one node.
This is what makes Cassandra tunable rather than fixed: a shopping-cart write can use CL ONE for speed, while a financial balance update can use QUORUM or ALL for stronger guarantees, all in the same cluster and even the same table.
The trade-off is the classic CAP one: pushing CL toward ALL improves consistency but sacrifices availability, since more replicas must be up and reachable for the request to succeed.
Invest now in Acorns!!! 🚀
Join Acorns and get your $5 bonus!
Acorns is a micro-investing app that automatically invests your "spare change" from daily purchases into diversified, expert-built portfolios of ETFs. It is designed for beginners, allowing you to start investing with as little as $5. The service automates saving and investing. Disclosure: I may receive a referral bonus.
Invest now!!! Get Free equity stock (US, UK only)!
Use Robinhood app to invest in stocks. It is safe and secure. Use the Referral link to claim your free stock when you sign up!.
The Robinhood app makes it easy to trade stocks, crypto and more.
Webull! Receive free stock by signing up using the link: Webull signup.
More Related questions...
