Database / Apache Cassandra Intermediate and Advanced interview questions
Why are lightweight transactions expensive in Cassandra?
Regular Cassandra writes are cheap precisely because they skip coordination: the coordinator just fires the mutation at all replicas and waits for the consistency-level count of acknowledgements. LWTs cannot take that shortcut, because they must guarantee only one outcome is agreed on across replicas.
- An LWT requires four round trips between the coordinator and replicas (Paxos Prepare/Promise, Propose/Accept, Commit/Acknowledge, plus an initial read to check the condition) instead of the single round trip a normal write uses.
- It must reach a quorum of the replicas responsible for the partition, regardless of the consistency level requested for other operations — there is no "LWT ONE" shortcut.
- Concurrent LWTs on the same partition serialize against each other; competing proposals cause retries, and heavy contention on one partition can create a queuing bottleneck.
Because of this overhead, LWTs are best reserved for genuinely conditional operations — unique constraint enforcement, leader election, distributed locks — not for general-purpose writes, where their throughput can be an order of magnitude lower than standard writes.
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...
