Quick revision
The short answer
The nodes are healthy but starved: gossip and failure detection run in the same JVM and on the same CPU quota as request processing, so CFS throttling under the pod's CPU limit and long GC pauses delay heartbeats, and peers' phi accrual detectors convict the node for an unusually long silence. We confirm it by lining up DOWN events with throttling and GC metrics, fix the platform first (no tight CPU limit, dedicated nodes, a heap and collector sized for short pauses), only then consider raising phi_convict_threshold moderately, and make clients tolerant with token-aware routing and speculative retries.
What to remember
In this answer, we traced flapping Cassandra nodes to their environment: CFS throttling under a tight CPU limit and long GC pauses froze the gossip thread, so peers' phi accrual detectors saw unusual silences and convicted healthy nodes. We confirmed it by lining up DOWN events with throttling and GC metrics, fixed the platform with no tight CPU limit, dedicated nodes and a well-sized heap and collector, kept phi_convict_threshold changes moderate and last, and made clients tolerant with token-aware routing and speculative retries for idempotent queries.
Your turn
Answer it aloud as you would in the interview, or type your answer below. Then show one part at a time and compare.
The nodes are healthy but starved: gossip and failure detection run in the same JVM and on the same CPU quota as request processing, so CFS throttling under the pod's CPU limit and long GC pauses delay heartbeats, and peers' phi accrual detectors convict the node for an unusually long silence. We confirm it by lining up DOWN events with throttling and GC metrics, fix the platform first (no tight CPU limit, dedicated nodes, a heap and collector sized for short pauses), only then consider raising phi_convict_threshold moderately, and make clients tolerant with token-aware routing and speculative retries.
Why this question is asked
Running Cassandra on Kubernetes brings a class of problems that never appeared on dedicated servers, and node flapping is the classic one. Logs say nodes go DOWN and come back seconds later, many times an hour, and each time some client requests time out. Interviewers ask this to see whether we look for the root cause in the platform instead of immediately tuning the database's detector. In this answer, we will recap how Cassandra decides a node is down, explain how CPU throttling and GC pauses trigger it, confirm the diagnosis with metrics, and then fix the platform, the database settings and the clients, in that order.
1A Quick Recap of How Cassandra Marks a Node Down
Cassandra nodes gossip every second: each node sends its state, including an increasing heartbeat counter, to a few peers. Every node records when it last saw each peer's heartbeat advance and feeds those intervals into a phi accrual failure detector. The detector computes phi, a suspicion level that rises the longer a peer stays silent compared with its normal rhythm. When phi passes phi_convict_threshold, 8 by default, the node logs that the peer is DOWN and stops sending it requests. When a fresh heartbeat arrives, it logs UP again.
So "is now DOWN" does not mean the node crashed. It means that, from some peer's point of view, its heartbeats stopped arriving for longer than usual.
2Why Healthy Nodes Look Dead
Gossip runs inside the same JVM as everything else, on the same CPU allowance. Kubernetes enforces a CPU limit using the Linux CFS quota: a pod with a limit of 4 CPUs may use 400 ms of CPU time in each 100 ms period. Cassandra is heavily multi-threaded, and during a burst of compaction or reads, 32 threads can use the whole 400 ms in about 12 ms. For the remaining 88 ms of that period, every thread in the container is frozen, including the gossip thread. This repeats period after period while the burst lasts, and gossip messages are delayed or bunch up. That is throttling, and the overview tells us it is heavy.
Long garbage collection pauses have the same effect: a 4-second pause stops gossip entirely. Peers see the heartbeat stop advancing, phi climbs past 8, and the node is convicted. A second later the throttling eases, a heartbeat arrives, and the node is UP again. Meanwhile, coordinators stopped routing to it and requests already waiting on it timed out, which is what clients notice.
- Burst of compaction or readsmany threads busy at once
- CFS quota used up early in the periodall threads frozen until next period
- Gossip heartbeats delayedoften together with GC pauses
- Peers' phi rises past 8silence longer than usual for this peer
- Node marked DOWNrequests for its ranges time out
- Throttling eases, heartbeat arrivesnode marked UP, cycle repeats
6 steps in order. Play them, or step through them one at a time.
3Confirming the Diagnosis
Before changing anything, we line the events up in time. From the container metrics we chart the rate of container_cpu_cfs_throttled_periods_total against container_cpu_cfs_periods_total for the Cassandra pods, and overlay the timestamps of the DOWN log lines from peers. From the GC logs, enabled with -Xlog:gc* on modern JVMs, we take pause durations. If DOWN events cluster at moments of high throttling or long pauses, the diagnosis is confirmed. We also check the node's load at those moments, its pending compactions and thread pools via nodetool tpstats, and look for packet loss between pods, because a lossy network would produce the same symptom with a different cause.
| Time | Throttled periods | Longest GC pause | DOWN events |
|---|---|---|---|
| 10:00-10:10 | 3 percent | 180 ms | 0 |
| 10:10-10:20 | 41 percent | 2.1 s | 4 |
| 10:20-10:30 | 38 percent | 3.4 s | 6 |
| 10:30-10:40 | 5 percent | 210 ms | 0 |
4Fix the Cause in the Platform
The fix starts where the cause is. CPU limits for a latency-sensitive database are usually a mistake: either remove the CPU limit, keeping an accurate CPU request so scheduling still works, or set the limit well above real peak usage. If the cluster requires Guaranteed quality of service, where requests equal limits, give the pod whole CPUs and use the kubelet's static CPU manager policy so it gets exclusive cores; check your Kubernetes version for how CFS quota is applied to exclusive cores. Run the database on dedicated nodes, using taints and tolerations, so it does not compete with noisy neighbours.
Then the JVM: size the heap for the workload, with equal -Xms and -Xmx, use a low-pause collector such as G1 with a sensible pause target or ZGC on a supported Java version, and make sure the container's memory limit leaves room for off-heap memory, which Cassandra uses a lot of. After these changes, the throttling metric should drop near zero and the DOWN events with it.
Notice that the memory limit remains. Running out of memory must still be contained, while CPU contention is better handled by dedicated nodes than by throttling.
5Only Then Tune the Detector and the Clients
Once the platform is fixed, if occasional false DOWN events remain on a noisy cloud network, we can raise phi_convict_threshold moderately in cassandra.yaml, for example from 8 to 10 or 12. Because phi is logarithmic, that tolerates noticeably longer silences, and the cost is slower detection of real failures. Raising it first, without fixing throttling, would only hide the symptom and make real failures take longer to detect.
Finally, clients should ride through a brief false DOWN. The DataStax Java driver is token-aware, sending each request straight to a replica that owns the data. With a speculative execution policy, if a replica has not answered within, say, the 99th percentile latency, the driver sends the same request to another replica and uses the first answer. Speculative execution must only be used for idempotent statements, which we mark explicitly, since the request may run twice.
6Follow-up questions
Why not simply raise the threshold to 16 and be done?
Because the nodes would still be throttled and paused, so latency would still spike, and real failures would take much longer to detect, leaving clients sending requests to dead nodes. The threshold should absorb normal network jitter, not cover a resource problem.
Can CPU throttling happen even when average CPU usage is well below the limit?
Yes, and that is what makes it confusing. The quota is enforced per 100 ms period, so a short burst of many threads can use the whole quota in a few milliseconds and be frozen for the rest of the period, even if the average over a minute is only 40 percent of the limit.
Does gossip use its own thread pool in Cassandra?
Gossip is processed on a dedicated stage, so it is not queued behind reads and writes, but it still needs CPU time and a running JVM. Throttling and GC pauses stop every thread in the process, which is why a separate stage does not protect it.
7Conclusion
In this answer, we traced flapping Cassandra nodes to their environment: CFS throttling under a tight CPU limit and long GC pauses froze the gossip thread, so peers' phi accrual detectors saw unusual silences and convicted healthy nodes. We confirmed it by lining up DOWN events with throttling and GC metrics, fixed the platform with no tight CPU limit, dedicated nodes and a well-sized heap and collector, kept phi_convict_threshold changes moderate and last, and made clients tolerant with token-aware routing and speculative retries for idempotent queries.
Open with
The nodes aren't dead, they're starved. Cassandra's gossip and failure detection run in the same JVM, on the same CPU quota, as request processing. With a CPU limit, the kernel's CFS quota lets the pod use, say, four hundred milliseconds of CPU per hundred-millisecond period; a burst of compaction across many threads burns that in a few milliseconds and then every thread, including gossip, is frozen until the next period.
Then, if they want more
Long GC pauses do the same. Peers see heartbeats stop advancing, their phi accrual detector's suspicion rises past the threshold of eight, and they mark the node DOWN; a second later a heartbeat arrives and it's UP again. During that window, requests for its ranges time out.
I'd confirm it by lining up the DOWN events with container_cpu_cfs_throttled_periods_total, GC pause logs and the node's load, and I'd check packet loss between pods.
Then I'd fix the platform first: remove the CPU limit or set it well above real usage while keeping accurate requests, or give Guaranteed pods whole cores with the static CPU manager, and put the database on dedicated nodes. I'd size the heap and use a low-pause collector.
Only after that would I consider raising phi_convict_threshold moderately, to ten or twelve on a noisy cloud network, accepting slower detection of real failures. And on the client side, token-aware routing plus speculative execution for idempotent queries, so a brief false DOWN doesn't fail requests.
About this answer
- Last updated
- 13 November 2026
- Checked
- Its structure and format are checked automatically. Use it as a carefully prepared study note: where a detail matters, confirm it against the official documentation for the version you use. What the checks cover
- Where the question comes from
- Written by Scrivio for practice. It is not taken from an interview.
Report an issue with this answer
Copy the line below and send it to the author with what you found. It carries the address of this page.
Issue with "Explain why healthy nodes are being marked down, and what you would change in the...": https://scrivio-interview-library.netlify.app/architecture/distributed-systems/4eb64aa0e1/