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.
More Related questions...