Quick revision
The short answer
I would first confirm that a few huge partitions are the cause with nodetool tablestats, tablehistograms and the large partition warnings in the logs, then identify the hot keys with nodetool toppartitions or application metrics. In the short term I would protect the node by caching or throttling the heavy readers and checking that token distribution and replication are not also uneven. The lasting fix is a data model change that splits those partitions with a bucket in the partition key, migrated without downtime by dual writes, a backfill, a read switch and removal of the old table, while watching compaction, repair and disk headroom.
What to remember
In this answer, we confirmed with nodetool tablestats, tablehistograms and the large partition warnings that a few huge partitions, not the topology, made one node hot, and identified the keys with toppartitions and application metrics. We relieved the node with caching, throttling and spreading reads across replicas, then fixed the model by adding a day bucket and a shard to the partition key, migrated with dual writes, a backfill, verification and a read switch, and planned for compaction, repair and disk headroom along the way.
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.
I would first confirm that a few huge partitions are the cause with nodetool tablestats, tablehistograms and the large partition warnings in the logs, then identify the hot keys with nodetool toppartitions or application metrics. In the short term I would protect the node by caching or throttling the heavy readers and checking that token distribution and replication are not also uneven. The lasting fix is a data model change that splits those partitions with a bucket in the partition key, migrated without downtime by dual writes, a backfill, a read switch and removal of the old table, while watching compaction, repair and disk headroom.
Why this question is asked
A single node running hot in a cluster of 24 is an important signal: Cassandra is supposed to spread data evenly, so an imbalance means either the cluster topology or the data model is wrong. Interviewers give this scenario to senior engineers because the answer needs a calm investigation, a short-term mitigation that keeps users served, and a migration that changes a table's key while the system stays online. In this answer, we will confirm the diagnosis, find the keys, relieve the hot node, design and run the migration, and plan for its operational impact.
1Why One Node Gets Hot
In Cassandra, the partition key is hashed into a token, and each node owns ranges of tokens. With a replication factor of 3, each partition is stored on three nodes. If partitions are of similar size and popularity, every node carries a similar share. When a few partitions are enormous or extremely popular, the replicas holding them carry far more data and requests than the rest, and no amount of adding nodes helps, because a single partition is never split across nodes.
One node at 90 percent and the others at 30 percent also has a second possible explanation: uneven token ownership, for example a node with more vnodes than the others, or a rack layout that concentrates replicas. So we check both before concluding.
2Confirming the Diagnosis
We start with the evidence Cassandra already gives us, comparing the hot node with a normal one.
The histogram is the key evidence: when the 99th percentile partition is a couple of megabytes but the maximum is gigabytes, a handful of partitions are far outside the norm. The log warnings, controlled by a large partition warning threshold whose name varies by version, name the actual keys. If nodetool status showed the hot node owning far more of the ring, we would be looking at a topology problem instead, and we would fix token allocation rather than the model.
3Finding the Hot Keys
Large is not the only problem; a partition can also be hot because it is read constantly. nodetool toppartitions samples the most active partitions on a node for a table over a period; the exact syntax differs between versions, so check yours. Application-side metrics are just as useful: if our service tags Cassandra requests with the tenant or entity id, a dashboard shows which keys dominate.
In our example the culprits are three tenants whose events all go into one partition per tenant, because the key is ((tenant_id), event_time). Those tenants are much larger than the others, so their partitions grew without bound, and their dashboards are also polled every few seconds.
4Relieving the Hot Node Now
While we prepare the model change, we reduce the load on the replicas. Reads that repeat, such as dashboards polling the same partition, go through a cache with a short TTL, which can remove most of the read load in a day. We throttle or reschedule heavy batch readers, such as exports, and make sure queries use LIMIT and paging so no request reads a whole huge partition at once.
We also check the cluster side: the node's num_tokens matches the others, the replication strategy and racks are set so that replicas spread, and the load balancing policy in the driver is token-aware but spreads reads across all three replicas rather than favouring one. If one replica is doing most of the reads, spreading them across the three can bring the hot node down significantly.
5Splitting the Partitions With a Bucket
The lasting fix is to change the partition key so no partition can grow without bound. We add a time bucket, and for the very largest tenants a small shard number.
The shard is computed from the event id, for example its hash mod 8, and readers query all eight shards for a day in parallel and merge. Small tenants use one shard, so their reads are unchanged. Notice that this also spreads the hot tenants across many nodes, which directly removes the hot spot.
6Migrating Without Downtime
We cannot alter a primary key in place, so we migrate to the new table in steps that can each be rolled back.
- Create events_v2New key with day and shard
- Dual writeEvery new event to both tables
- Backfill historyThrottled, paged, per tenant
- VerifyCounts and samples match
- Switch readsFeature flag, can roll back
- Stop old writes, drop tableAfter a safe period
6 steps in order. Play them, or step through them one at a time.
Every step before the drop is reversible.
First the application writes every new event to both tables. Then a throttled backfill job copies history from the old table into the new one, partition by partition, using paging so it never reads a huge partition in one go. We verify by comparing counts and samples per tenant. Then we switch reads to the new table behind a feature flag, tenant by tenant if we want, and keep dual writes for a while so we can switch back. Finally we stop writing to the old table and drop it.
7Watching Compaction, Repair and Disk
The migration itself adds load. Dual writes and the backfill double write volume on the table, which means more compaction, so we throttle the backfill and watch pending compactions and read latency. The new table temporarily doubles disk use, and compaction needs free space to rewrite SSTables, so the hot node, already at 90 percent disk, needs headroom first: we can add capacity, clear snapshots, or run the backfill for the smallest tenants first. Repairs of the old huge partitions are slow and heavy, so we pause or reschedule them for that table during the migration and resume a full repair on the new table afterwards. When the old table is dropped, Cassandra keeps a snapshot by default (auto_snapshot), which we delete once we are sure.
8Follow-up questions
Could adding nodes fix this faster?
Not for the root cause. A partition always lives entirely on its replicas, so new nodes take token ranges from others but the giant partitions stay together on three nodes. Adding nodes can give the cluster more total capacity, but the hot replicas stay hot until the model changes.
How do you keep the dual writes consistent?
Both writes happen in the application for each event. If the second fails, we retry it, since inserts are idempotent with the same primary key; a logged batch can also make both writes eventually apply together. The verification step before the read switch catches any gaps, and the backfill can be rerun for a tenant because rewriting the same rows is harmless.
9Conclusion
In this answer, we confirmed with nodetool tablestats, tablehistograms and the large partition warnings that a few huge partitions, not the topology, made one node hot, and identified the keys with toppartitions and application metrics. We relieved the node with caching, throttling and spreading reads across replicas, then fixed the model by adding a day bucket and a shard to the partition key, migrated with dual writes, a backfill, verification and a read switch, and planned for compaction, repair and disk headroom along the way.
Open with
First I would confirm what the histograms suggest. I would compare nodetool status ownership across nodes, to rule out uneven tokens or racks, then look at nodetool tablestats and tablehistograms for the table: if the p99 partition size is a few megabytes but the max is gigabytes, a few partitions are the problem, and the large partition warnings in the log name the keys.
Then, if they want more
I would also use nodetool toppartitions, checking the syntax for our version, or application metrics to see which keys are hot by reads.
In the short term I would protect the node: cache the repeated reads like dashboards with a short TTL, throttle heavy exports, make sure queries page instead of reading whole partitions, and check that the driver spreads reads across all replicas. The real fix is the data model.
Adding nodes does not split a partition, so I would create a new table with a bucket in the partition key, for example tenant, day and a shard number for the biggest tenants, and migrate without downtime: dual writes, a throttled paged backfill, verification of counts, a read switch behind a flag, and only then drop the old table.
During that I would watch compaction backlog and disk headroom, since the hot node is already at 90 percent, and reschedule heavy repairs.
About this answer
- Last updated
- 12 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 documentation below. What the checks cover
- Where the question comes from
- Written by Scrivio for practice. It is not taken from an interview.
- Official documentation
- Apache Cassandra documentation, Amazon DynamoDB developer guide
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 "A Cassandra cluster of 24 nodes shows one node at 90 percent CPU and disk, while others...": https://scrivio-interview-library.netlify.app/databases/cassandra-and-dynamodb/be350057fa/