Quick revision
The short answer
Waiting until 82 percent disk use left no room, because log-structured stores need free space for compaction and for data in flight, so expansions should start around 50 to 60 percent. Adding 20 nodes at once made almost every node stream at full speed at the same time; nodes should be added in small steps with throttled streaming so foreground traffic keeps priority. Old nodes keep their data until the new owners confirm the copy, so their disk rises before it falls, and capacity should be managed with forecasts, rehearsed in staging with production-sized data and automated.
What to remember
In this answer, we traced the incident to three causes. At 82 percent there was no room for compaction and data in flight, so expansions should start around 50 to 60 percent. Adding 20 nodes at once made almost every node stream at full speed, so nodes should be added in small, throttled steps that leave foreground traffic its priority. Old nodes keep their data until new owners confirm and cleanup runs, so their disk rises before it falls. Capacity should be tracked with forecasts such as days to 70 percent against expansion time, and expansions rehearsed with production-sized data and automated.
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.
Waiting until 82 percent disk use left no room, because log-structured stores need free space for compaction and for data in flight, so expansions should start around 50 to 60 percent. Adding 20 nodes at once made almost every node stream at full speed at the same time; nodes should be added in small steps with throttled streaming so foreground traffic keeps priority. Old nodes keep their data until the new owners confirm the copy, so their disk rises before it falls, and capacity should be managed with forecasts, rehearsed in staging with production-sized data and automated.
Why this question is asked
Capacity incidents are rarely caused by one bad decision; they come from a reasonable-sounding plan that ignores how the storage engine behaves under load. Here, adding a third more nodes in one go both slowed reads 80-fold and filled two disks completely. Interviewers ask this to see whether we understand compaction, streaming and the temporary cost of moving data. In this answer, we will see why 82 percent was too late, why adding 20 nodes at once hurt latency, why old nodes filled up, and how to plan capacity and run expansions safely.
1Why 82 Percent Was Already Too Late
A log-structured store, such as Cassandra or a RocksDB-based store, never edits files in place. Compaction reads several sorted files and writes a new merged file, and only deletes the inputs after the output is complete. During that time both copies exist. With size-tiered compaction, merging the largest files can temporarily need free space comparable to the data being merged, in the worst case close to half the node's data; leveled compaction needs much less but still needs some.
Expansion adds a second consumer of free space: data in flight. Streams of incoming ranges land on new nodes, and on old nodes temporary files and snapshots can appear while ranges are sent. At 82 percent there is 18 percent of free space for all of this, which a single large compaction can consume. That is why the rule of thumb is to start expansions at around 50 to 60 percent, when there is room for compaction, streaming and the unexpected.
2Why Adding 20 Nodes at Once Hurt Latency
With consistent hashing and virtual nodes, a new node takes small ranges from many existing nodes. Adding one node to 60 means a handful of nodes each send a little data. Adding 20 at once means the new nodes together take a quarter of all data, about 20/80, from almost every old node at the same time.
Each old node was then reading large ranges from disk, sending them over the network, and continuing to compact, all while serving reads. Disk and network bandwidth were shared with foreground traffic, and streaming at full speed won. Reads queued behind streaming I/O, and p99 went from 5 ms to 400 ms. The fix is to add nodes in small steps, for example two to four at a time, and throttle streaming bandwidth per node, for example to 50 MB/s, so that foreground reads and writes keep priority. The expansion takes longer, but nobody notices it.
| Plan | Nodes streaming at once | Read p99 | Duration |
|---|---|---|---|
| All 20 at once, unthrottled | almost all 80 | 5 ms -> 400 ms | fast, then incidents |
| Steps of 4, throttled to 50 MB/s | a few per step | stays near 5 to 8 ms | a few days |
3Why Old Nodes Filled Up While Still Sending
Moving a range is a copy followed by a cleanup, not a move. The old owner keeps serving the range while it streams a copy to the new owner, and ownership switches only after the new node confirms it has everything. Even then, the old copy stays on disk until a cleanup step removes data the node no longer owns. So during an expansion, disk use on old nodes first rises, because of compaction of incoming writes, temporary stream files and snapshots, and only falls after cleanup.
The two nodes that ran out of disk were already near full, were sending data and were compacting at the same time, and nothing removed their old ranges until the very end. The procedure should run cleanup on each old node promptly after its ranges have moved, step by step, and watch disk use on both the sending and the receiving side.
- New node joins and claims rangespartition map updated as pending
- Old owner streams a copythrottled; keeps serving reads and writes
- New owner confirms the full copy?checksums verifiedYesSwitch ownershipNoKeep streaming, old owner still serves
- Run cleanup on the old ownerdeletes data it no longer owns
- Disk on old owner fallsonly now does the expansion free space
5 steps in order. Play them, or step through them one at a time.
4Planning Capacity With Forecasts
The root cause is that the team alerted on current usage. 82 percent is a level; what matters is when we will reach the point where expansion becomes risky, and how long an expansion takes. So capacity is tracked with forecasts: growth rate per day, days until 70 percent, the largest compaction headroom needed, and the measured duration of an expansion.
Alerting on the forecast means the expansion starts while there is plenty of room and time, instead of as an emergency when the rule of thumb is already broken.
5Rehearse and Automate the Expansion
An expansion is a rare, risky operation, so it deserves the same treatment as a release. We rehearse it in a staging cluster loaded with production-sized data and a replay or synthetic copy of production traffic, and we measure p99 latency during streaming at different throttle settings. That rehearsal gives us the right step size and throttle for production.
Then we automate the procedure: a runbook turned into a tool that adds a few nodes, waits for streaming to finish, verifies ownership, runs cleanup, checks disk and latency, and only then continues to the next step, halting automatically if p99 or disk use crosses a limit. Automation means the expansion runs the same way each time, whoever is on call.
6Follow-up questions
Why not add many nodes at once with very low throttling?
Then every old node streams slowly for a long time, holding extra data and snapshots for the whole duration, which keeps disk pressure high everywhere. Small steps finish and clean up each batch, so free space recovers progressively.
Does leveled compaction remove the free-space problem?
It reduces it, since it merges smaller sets of files, but it does more write I/O overall and still needs some free space. The right strategy depends on the workload; either way, free-space headroom must be planned.
What should you do if a node is about to run out of disk mid-expansion?
Pause streaming to and from it, stop or slow its compactions if safe, run cleanup on ranges it no longer owns, and if needed temporarily add disk or move a few ranges elsewhere. Running out of disk can corrupt in-progress writes, so prevention by pausing is far better.
7Conclusion
In this answer, we traced the incident to three causes. At 82 percent there was no room for compaction and data in flight, so expansions should start around 50 to 60 percent. Adding 20 nodes at once made almost every node stream at full speed, so nodes should be added in small, throttled steps that leave foreground traffic its priority. Old nodes keep their data until new owners confirm and cleanup runs, so their disk rises before it falls. Capacity should be tracked with forecasts such as days to 70 percent against expansion time, and expansions rehearsed with production-sized data and automated.
Open with
Three things went wrong. First, waiting until 82 percent left no room. Log-structured stores need free space for compaction, since a merge writes new files before deleting old ones and can temporarily need a large share of a node's data, and expansion adds data in flight, so I would plan to start expansions around 50 to 60 percent.
Then, if they want more
Second, adding 20 nodes at once meant the new nodes took a quarter of the data from almost every old node at the same time, so every node streamed at full speed and foreground reads queued behind that I/O. I would add nodes in small steps, a few at a time, and throttle streaming bandwidth so foreground traffic keeps priority.
Third, old nodes keep their data until the new owners confirm the copy and cleanup runs, so their disk use rises before it falls; the two nodes that were already near full filled up while still sending. Cleanup should run promptly after each step, with disk watched on both sides.
Going forward, I would track capacity with forecasts, growth rate, days to 70 percent, compaction headroom and how long an expansion takes, and alert on the forecast rather than current usage. And I would rehearse expansions in a staging cluster with production-sized data, measure latency during streaming, and automate the procedure so it runs the same way each time.
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 "What went wrong with this expansion, and how should capacity planning and rebalancing...": https://scrivio-interview-library.netlify.app/architecture/system-design-problems/585c1f2081/