Quick revision
The short answer
Equal partition counts do not mean equal load, because partitions differ in size and rate. Check per-replica sizes on broker 4 with kafka-log-dirs.sh and per-topic BytesInPerSec to find what dominates, then relieve it with a throttled reassignment of a few large replicas to the emptier brokers, never by deleting segment files. Prevent a repeat by balancing on size and throughput rather than counts, alerting on disk use and skew, and designing keys that avoid hot partitions.
What to remember
In this answer, we saw that equal partition counts hide unequal partition sizes and rates. We found what dominates broker 4 with kafka-log-dirs.sh and per-topic BytesInPerSec, considered hot keys, placement, long retention and leadership as causes, and relieved the disk with a throttled reassignment of the largest replicas, or a move between log directories on JBOD, keeping retention cuts as a last resort and never deleting segment files by hand. To prevent it, we balance on size and throughput, alert on disk use and skew, choose partition counts that divide evenly and review key design.
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.
Equal partition counts do not mean equal load, because partitions differ in size and rate. Check per-replica sizes on broker 4 with kafka-log-dirs.sh and per-topic BytesInPerSec to find what dominates, then relieve it with a throttled reassignment of a few large replicas to the emptier brokers, never by deleting segment files. Prevent a repeat by balancing on size and throughput rather than counts, alerting on disk use and skew, and designing keys that avoid hot partitions.
Why this question is asked
A single broker filling up while its neighbours sit at half capacity is a classic Kafka operations problem, and the fact that partition counts look even is exactly what makes it confusing. Interviewers ask this debugging question to see whether we look at the right numbers, relieve the pressure safely while traffic continues, and fix the cause rather than the symptom. In this answer, we will see why counts mislead, find what is on broker 4, go through the usual causes, relieve the disk now, list what we must never do, and set up the prevention.
1Why Equal Partition Counts Mislead
Kafka's default placement spreads partition replicas across brokers by count. But partitions are not equal. One topic's partitions may receive 20 MB/s each and keep 7 days of data, another's may receive a few kilobytes and keep a day. A broker with the same number of partitions as its neighbours can therefore hold several times more data and receive several times more bytes. Broker 4's high bytes-in rate together with its full disk says that it holds more of the heavy partitions, so we need sizes and rates, not counts.
2Finding What Is on Broker 4
kafka-log-dirs.sh reports the size of every replica on a broker, by log directory. Sorting its output shows at once which partitions take the space.
Here two partitions of clicks hold about 800 GB together on broker 4, and an audit topic with long retention adds more. Per-topic BytesInPerSec on each broker shows which topics drive the write rate. Comparing the same partitions' sizes with other partitions of the same topic tells us whether the topic is skewed or simply big.
3The Usual Causes
Four causes account for most cases. Hot keys: a producer keys by something like customer id, and one very large customer sends a large share of traffic to one partition, which grows faster than its siblings. Unlucky placement: several partitions of one large topic were placed on broker 4, for example when the topic was created while other brokers were down. Long retention: a topic with 30 days of retention instead of 7 holds four times the data per unit of traffic, and broker 4 has more of its partitions. And leadership: leaders handle all produce requests and most consumer fetches, so a broker leading more busy partitions has higher bytes in and out even if storage is balanced; that explains network load but not disk, so it often comes alongside one of the others.
In our example, clicks-17 and clicks-5 are far larger than other clicks partitions, which points at hot keys, and the audit topic's long retention adds to it.
- Sizes per replica on broker 4
kafka-log-dirs.sh, sorted - One topic's partitions uneven?Yeshot keys: check producer keysNocheck placement and retention
- Many large partitions placed on 4?Yesunlucky placement: reassignNocheck retention
- Long retention topic on 4?Yesretention drives sizeNocheck leader counts
- Relieve now, then preventthrottled reassignment, balancing
5 steps in order. Play them, or step through them one at a time.
4Relieving Broker 4 Now
At 91 percent we act now, before the disk fills. The safe tool is a reassignment that moves a few of the largest replicas from broker 4 to brokers with space, with a throttle so the copy does not hurt production traffic.
While the copy runs, the target brokers temporarily hold the new replicas, and broker 4 frees its space only when the move completes, so we pick targets with clear room and start with partitions that free the most. If broker 4 uses JBOD, several disks as separate log directories, and only one directory is full, we can instead move replicas between its own directories by adding a log_dirs list with absolute paths to the reassignment JSON. Reducing retention on a non-critical topic frees space fastest, but it deletes data consumers may need, so it is the last resort and needs the owner's agreement.
5What Not to Do
Never delete segment files by hand to free space. The broker keeps its own view of each log, its segments, indexes and offsets; removing files underneath it makes that view inconsistent, can crash the broker or make it truncate or lose data on restart, and can spread inconsistency to followers. Space must be freed through Kafka: reassignment, retention changes or deleting a topic properly.
6Preventing It From Happening Again
The lasting fix is balancing on the right signals. A balancer such as Cruise Control places replicas based on disk use, network in and out and leader counts, and can rebalance continuously. We alert on per-broker disk use, for example at 75 percent, and on skew, such as one broker more than 15 points above the cluster median, so a drift is found weeks before it becomes urgent. Partition counts that are multiples of the broker count make an even spread possible in the first place. And with producer teams we review key design: a key that concentrates traffic, such as one large customer, needs a different key or a salt added to spread that customer's records, accepting the loss of per-key ordering where that is acceptable.
7Follow-up questions
Why does a broker that leads many busy partitions have higher bytes in?
Producers send all writes for a partition to its leader, and followers fetch from the leader to replicate. So a leader receives the producer traffic, while followers receive the same bytes through replication. Consumers also fetch from leaders by default, which adds bytes out. Preferred leader election evens out leadership without moving data.
How fast should the throttle be?
Fast enough to free space before the disk fills, slow enough to leave headroom for production traffic. We estimate spare network on the source and target brokers, start conservatively, and raise it if latency and under-replicated partitions stay normal.
Could adding a broker fix this?
Only if we then move data to it. New brokers receive no existing partitions automatically, so adding one without a reassignment does nothing for broker 4.
8Conclusion
In this answer, we saw that equal partition counts hide unequal partition sizes and rates. We found what dominates broker 4 with kafka-log-dirs.sh and per-topic BytesInPerSec, considered hot keys, placement, long retention and leadership as causes, and relieved the disk with a throttled reassignment of the largest replicas, or a move between log directories on JBOD, keeping retention cuts as a last resort and never deleting segment files by hand. To prevent it, we balance on size and throughput, alert on disk use and skew, choose partition counts that divide evenly and review key design.
Open with
Equal partition counts do not mean equal load, because partitions differ a lot in size and rate. So first I would run kafka-log-dirs.sh with describe for broker 4 to list the size of every replica, sort it, and look at per-topic BytesInPerSec to see which topics dominate.
Then, if they want more
Typical causes are hot keys concentrating traffic in a few partitions, several partitions of one big topic landing on broker 4, a topic with much longer retention, or broker 4 leading more busy partitions, since leaders take all produce traffic and serve consumers.
To relieve it now, I would move a few of the largest replicas off broker 4 with a throttled reassignment, using kafka-reassign-partitions with execute and a throttle, then verify until it completes, which also removes the throttle.
If broker 4 uses JBOD and one directory is full, I can move replicas between its own log directories with log_dirs in the reassignment JSON. Reducing retention on a non-critical topic is the last resort. What I would never do is delete segment files by hand, because the broker's view of the log becomes inconsistent and data can be lost.
To prevent it, I would balance on size and throughput rather than counts, for example with Cruise Control, alert on per-broker disk use and on skew between brokers, use partition counts that are multiples of the broker count, and work with producers on keys that avoid hot partitions.
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 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 Kafka documentation
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 do you check, how do you relieve broker 4 now, and how do you prevent it from...": https://scrivio-interview-library.netlify.app/spring-boot/kafka-operations/1f2db2d31e/