Database / Apache Cassandra Intermediate and Advanced interview questions
What role does the Paxos protocol play in Cassandra's lightweight transactions?
Cassandra implements a variant of the Paxos consensus algorithm to make LWTs linearizable across replicas without needing a single elected leader.
- Prepare/Promise: the coordinator asks replicas to promise not to accept any older proposal, establishing a ballot number higher than anything seen before.
- Read: the current value is read (and the condition, like
IF balance = 100, is evaluated) to decide whether the write should proceed. - Propose/Accept: if a quorum promised, the coordinator proposes the actual mutation, and replicas accept it if they haven't promised a newer ballot in the meantime.
- Commit/Acknowledge: once a quorum accepts, the coordinator tells replicas to commit the value, making it durable and visible.
This ballot-based approach lets any node coordinate an LWT and still reach agreement safely, even if multiple nodes try to propose conflicting updates at the same time — competing proposals simply retry with higher ballots until one wins. It's this mechanism, not the normal write path, that gives LWTs their strong linearizable consistency guarantee.
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...
