Database / Apache Cassandra Intermediate and Advanced interview questions
How do you handle consistency across multiple datacenters in Cassandra?
Multi-datacenter Cassandra deployments need consistency levels that are aware of DC boundaries, since waiting on remote datacenters for every request can add significant latency.
| LOCAL_QUORUM | EACH_QUORUM |
| Requires a quorum of replicas within the local DC only. | Requires a quorum of replicas in every DC. |
| Low latency; unaffected by cross-DC network conditions. | Higher latency; every DC must be reachable and healthy. |
| Common default for most multi-DC applications. | Used when every region must see consistent data immediately. |
SELECT * FROM orders WHERE order_id = 'o1'; -- CL LOCAL_QUORUM in driver config
- Most applications use
LOCAL_QUORUMfor both reads and writes, accepting that other datacenters catch up asynchronously (typically within milliseconds under normal conditions). EACH_QUORUMis reserved for cases where cross-region staleness is unacceptable, since it sacrifices availability — a single unreachable DC blocks the whole operation.- Replication itself (via
NetworkTopologyStrategy) always sends writes to all configured DCs regardless of consistency level; the CL only controls how many acknowledgements the coordinator waits for before responding.
The general guidance is: default to LOCAL_QUORUM for day-to-day traffic, and reserve EACH_QUORUM for the rare operations where every region absolutely must be in sync before continuing.
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...
