⚡ ~/naveed Interview Prep
⚡ Portfolio Home 👤 About Naveed Bio & Credentials ⚖️ Editorial Policy Standards & Trust 📫 Contact Naveed Get In Touch ✍️ Engineering Blog Deep Dives 🎯 Interview Hub 1,000+ Scenarios ☸️ Kubernetes Mastery Hub 24 Modules 🎮 DevOps Arcade & Quizzes Subnet Blitz ⚡ 🗺️ DevOps Roadmaps PDFs & Guides 🤖 Morpheus Analysis AI Quant ↗ 🛠️ Developer Tools Utilities 🧪 Labs & Experiments 📄 Interactive CV & Certs 🔗 All Links & Socials ⚡ Join The Dispatch (Weekly SRE Newsletter) →
← Back to All Databases & Storage Interview Questions Scenario 61 of 69 in Databases & Storage
Senior DevOps / SRE Database Replication Lag & Failover Production Runbook
🎯 Target Role / Context: Senior DevOps / SRE Database Reliability Interview Scenario

Q: How does Cassandra handle cross-region write consistency during a WAN partition when you use LOCAL_QUORUM versus ALL?

Cassandra interview questions on multi-DC consistency: LOCAL_QUORUM vs ALL, NetworkTopologyStrategy, hinted handoff limits and repair after a WAN partition.

#Cassandra #LOCAL_QUORUM #NetworkTopologyStrategy #CAP Theorem #Hinted Handoff #Multi-DC
🎙️ Candidate Opening & Architectural Context
"Cassandra interview questions on multi-region consistency are really CAP theorem questions with a concrete tool in your hand. The interviewer wants to hear that you choose consistency per request, that you know what each level needs from the cluster, and that you know what happens to the data on the far side of the cut after the link returns. I frame the answer around a two-datacenter cluster, dc1 and dc2, each holding three replicas. When the WAN link between them fails, both datacenters are still healthy internally. A write at ALL needs all six replicas and will fail in both regions. A write at LOCAL_QUORUM needs two of the three replicas in the local datacenter and keeps working. The price is that the two sides now diverge, and I need hinted handoff and then repair to converge them. I explain this as a deliberate availability choice for most user-facing paths, with stronger levels reserved for the few operations that must not diverge."
Advertisement
⚡ Recommended Practice Lab

Want to master this scenario in a live sandbox? KodeKloud's PostgreSQL Database Administration & High Availability Course covers this exact problem with hands-on terminal drills.

🛠️ Production Runbook & Step-by-Step Resolution

Direct Answer: Cassandra interview questions on multi-region consistency are really CAP theorem questions with a concrete tool in your hand. The interviewer wants to hear that you choose consistency per request, that you know what each level needs from the cluster, and that you know what happens to the data on the far side of the cut after the link returns. I frame the answer around a two-datacenter cluster, dc1 and dc2, each holding three replicas. When the WAN link between them fails, both datacenters are still healthy internally. A write at ALL needs all six replicas and will fail in both regions. A write at LOCAL_QUORUM needs two of the three replicas in the local datacenter and keeps working. The price is that the two sides now diverge, and I need hinted handoff and then repair to converge them. I explain this as a deliberate availability choice for most user-facing paths, with stronger levels reserved for the few operations that must not diverge.

1

Set replication per datacenter with NetworkTopologyStrategy

Multi-DC clusters use NetworkTopologyStrategy so I can state how many replicas live in each datacenter. SimpleStrategy ignores topology and should not be used outside single-DC development. The datacenter names in the keyspace must match the names reported by the snitch exactly, or replicas will not be placed where I expect.

CREATE KEYSPACE payments
  WITH replication = {
    'class': 'NetworkTopologyStrategy',
    'dc1': 3,
    'dc2': 3
  };

-- Confirm datacenter names match what the cluster reports
-- $ nodetool status
-- Datacenter: dc1
-- UN  10.0.1.11  ...  rack1
-- Datacenter: dc2
-- UN  10.1.1.11  ...  rack1
2

Configure the snitch so the cluster knows its topology

GossipingPropertyFileSnitch is the usual production choice. Each node declares its own datacenter and rack in cassandra-rackdc.properties and shares that through gossip, so I do not maintain a cluster-wide topology file. Drivers should use a datacenter-aware load balancing policy that prefers the local datacenter, otherwise LOCAL_QUORUM requests may be coordinated across the WAN.

# cassandra.yaml
endpoint_snitch: GossipingPropertyFileSnitch

# /etc/cassandra/cassandra-rackdc.properties on a dc1 node
dc=dc1
rack=rack1

# Verify the topology gossip sees
nodetool status
nodetool gossipinfo | grep -E 'DC|RACK'
Advertisement
3

Compare what each consistency level needs during the partition

With RF 3 in each DC, LOCAL_QUORUM needs 2 local replicas, QUORUM needs 4 of 6 across both datacenters, EACH_QUORUM needs 2 in every datacenter, and ALL needs all 6. During a WAN cut, LOCAL_QUORUM still succeeds in both regions. QUORUM succeeds nowhere, because each side sees only 3 replicas, and EACH_QUORUM and ALL fail. This is the CAP trade in practice: LOCAL_QUORUM favours availability, ALL favours consistency.

cqlsh> CONSISTENCY LOCAL_QUORUM;
cqlsh> INSERT INTO payments.ledger (id, amount) VALUES (uuid(), 42);
-- OK in dc1 and dc2 during the partition

cqlsh> CONSISTENCY ALL;
cqlsh> INSERT INTO payments.ledger (id, amount) VALUES (uuid(), 42);
-- NoHostAvailable / UnavailableException: Cannot achieve consistency level ALL
-- (required 6 replicas, alive 3)
4

Understand hinted handoff and its time limit

When a replica is unreachable, the coordinator stores a hint and replays it when the node returns. Hints are an optimisation, not a guarantee. They are only kept while the target has been down for less than max_hint_window, which defaults to 3 hours (older versions call it max_hint_window_in_ms, with a value of 10800000). If the partition lasts longer, the coordinator stops writing hints and the data on the far side can only be recovered by repair.

# cassandra.yaml (3 hours; setting name varies by version)
max_hint_window: 3h
# older releases: max_hint_window_in_ms: 10800000

nodetool statushandoff
# Hinted handoff is running

# Pending hint backlog and streaming activity
nodetool tpstats | grep -i hint
nodetool netstats
5

Repair after the partition heals

Once the link is back, I let hints replay and then run repair on the affected keyspace, especially if the outage exceeded the hint window. Reads at LOCAL_QUORUM will serve each region's own view until convergence, so I tell product teams that cross-region read-your-writes is not guaranteed at this level. For operations that must be globally consistent, I use a stronger level or a lightweight transaction on a small path, and accept the availability cost.

# Run on each node, primary ranges only, for the keyspace that took writes
nodetool repair -pr payments

# Watch progress and streaming
nodetool netstats
grep -i 'repair' /var/log/cassandra/system.log | tail
💡 The Senior SRE Gold Nugget (Key Architectural Takeaway)
"For cassandra interview questions on multi-region writes, state that NetworkTopologyStrategy sets replicas per datacenter, LOCAL_QUORUM keeps each region writable during a WAN partition, ALL fails everywhere, and hinted handoff only covers outages shorter than max_hint_window. Convergence after a long partition needs repair."
⚡ 60-Second Elevator Pitch Talking Points
  • NetworkTopologyStrategy places a chosen number of replicas in each datacenter, and the snitch supplies the topology.
  • LOCAL_QUORUM needs a majority of local replicas, so both regions keep accepting writes during a WAN partition.
  • ALL and EACH_QUORUM need remote replicas and fail, which is the consistency side of the CAP trade.
  • Hints cover short outages up to max_hint_window; after that I run repair to converge the datacenters.
⛔ Critical Candidate Mistakes to Avoid in This Scenario

Senior hiring managers and bar raisers evaluate how you prioritize during outages. Avoid these common anti-patterns:

  1. Using ALL for general write traffic in a multi-DC cluster One slow or unreachable remote replica turns into a full write outage for the application.
  2. Assuming hinted handoff guarantees convergence Hints stop after max_hint_window and can be lost if the coordinator fails, so repair is still required.
  3. Leaving the driver without a local-datacenter policy Requests can be coordinated in the remote region and pay WAN latency or fail during a partition.
  4. Mismatching datacenter names between keyspace and snitch Replicas are not placed where the replication map says, and consistency levels behave unpredictably.
Advertisement
Want more Databases & Storage scenarios?
Explore our complete collection of scenario-based Databases & Storage interview runbooks.
Browse All Databases & Storage Questions →