Quick revision
The short answer
With time-based retention we size on the average rate: 3 MB/s for 7 days is about 1.8 TB, about 5.4 TB with 3 replicas, so roughly 0.9 TB per broker on 6 brokers if partitions are spread evenly. On top of that we leave room for up to one extra segment per partition, for disks to stay below about 60 to 70 percent, for moving a dead broker's replicas to the survivors (about 20 percent more each), and for internal and other topics.
What to remember
In this answer, we estimated disk from the average rate because time-based retention keeps the last 7 days: 3 MB/s gives about 260 GB a day, 1.8 TB a week, 5.4 TB with three replicas, roughly 0.9 TB per broker. We added up to one extra segment per partition replica, headroom to keep disks below 60 to 70 percent for growth, skew and reassignments, about 20 percent more per survivor if a dead broker's replicas move, and the space other and internal topics already use, with retention.bytes as a safety cap.
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.
With time-based retention we size on the average rate: 3 MB/s for 7 days is about 1.8 TB, about 5.4 TB with 3 replicas, so roughly 0.9 TB per broker on 6 brokers if partitions are spread evenly. On top of that we leave room for up to one extra segment per partition, for disks to stay below about 60 to 70 percent, for moving a dead broker's replicas to the survivors (about 20 percent more each), and for internal and other topics.
Why this question is asked
Capacity estimates are a small, practical skill that interviewers use to see whether we understand how Kafka actually stores and deletes data, not just how to multiply. A topic sized only on the headline numbers can fill a broker's disk and take its partitions offline, which is one of the more painful Kafka incidents. In this answer, we will recap how retention deletes data, do the calculation step by step with our assumptions, then add the extra space segments need, the headroom for operations and broker failure, and the other topics that share the disks.
1A Quick Recap of How Kafka Keeps and Deletes Data
Each partition is stored as a sequence of segment files on the broker's disk. New records are appended to the active segment; when it reaches segment.bytes (1 GB by default) or segment.ms has passed (7 days by default), it is closed and a new one starts. With retention.ms set, Kafka deletes a closed segment once its newest record is older than the retention time. It never deletes part of a segment and never deletes the active one.
Every replica stores the full data of its partition, so a replication factor of 3 means three copies of every byte, spread over three different brokers.
2The Calculation, Step by Step
Time-based retention keeps whatever arrived during the last 7 days, so the amount on disk depends on the average rate over those days, not the peak. Peaks matter for network and request capacity, but for disk a short peak is averaged out. We assume the 3 MB/s average is measured as compressed bytes on disk, that partitions and their replicas are spread evenly over the 6 brokers, and that the rate is stable over the week.
So the topic needs about 0.9 TB per broker today. Notice the growth line: an estimate is only useful for as long as the traffic it assumed, so we redo the sum with the expected growth over the hardware's planned life and size for that number.
3Segments Stay Longer Than the Retention Time
Because Kafka deletes whole closed segments, the oldest segment of a partition stays until its newest record passes the retention time. In the worst case almost a full segment of data older than 7 days is still on disk, and the active segment is there too. The extra is up to about one segment per partition replica.
With 12 partitions, 36 replicas and 1 GB segments, that is up to 36 GB across the cluster, about 6 GB per broker, small next to 0.9 TB. But on a topic with 300 partitions and little traffic each, segments may take days to fill, and the extra can be as large as the retained data itself. That is when segment.ms or a smaller segment.bytes helps.
4Headroom for Operations and Broker Failure
A broker whose log directory fills up cannot write, and its partitions on that directory go offline, so we never plan disks to be full. Many teams keep disks below 60 to 70 percent in normal operation, for three reasons: traffic growth that arrives before new hardware, partitions that are not as even as assumed because keys skew traffic, and partition reassignments, which keep both the old and the new replica until the move completes.
Broker failure needs its own room. Kafka does not re-replicate automatically when a broker dies; its partitions run with fewer replicas until it returns. If we decide to restore the replication factor by moving the dead broker's replicas to the five survivors, each takes one fifth of its 0.9 TB, so each needs about 1.08 TB, 20 percent more.
| Item | Per broker | Note |
|---|---|---|
| Retained data, 7 days, RF 3 | 0.9 TB | average rate, even spread |
| Extra closed and active segments | about 6 GB | 12 partitions, 1 GB segments |
| After moving a dead broker's replicas | about 1.08 TB | 5 survivors share its load |
| Disk to provision at 65% target use | about 1.7 TB | 1.08 TB / 0.65, before growth |
5Counting Everything Else on the Disks
The topic does not have the disks to itself. Other topics, internal topics such as __consumer_offsets and the transaction state topic, and the internal topics of Kafka Connect and Kafka Streams applications all take space, some of it compacted and long-lived. The estimate for the new topic is added to the current usage per broker, not to an empty disk.
For topics whose volume is hard to predict, retention.bytes is a useful safety cap. It limits the size of each partition, so a sudden flood deletes older data early instead of filling the disk. It applies per partition, so a cap of 100 GB on a 12-partition topic allows 1.2 TB per copy. We set it as a ceiling above the expected size, not as the main retention control.
6Follow-up questions
How would tiered storage change this calculation?
With tiered storage, closed segments are copied to object storage, and brokers keep only a local retention window on disk, for example one day. Broker disk is then sized for about 260 GB x 3 / 6, roughly 130 GB per broker plus headroom, while object storage holds the 7 days, about 1.8 TB, typically as a single copy since it is already durable. Reads of older data come from object storage, so consumers replaying old data see higher latency.
Why not size on the 5 MB/s peak?
For disk with time-based retention, a peak lasting an hour adds an hour's worth of extra data, which is small over seven days. Sizing on peak would overestimate disk by about two thirds. The peak does matter for network, request handling and replication capacity, which we check separately.
Does compression change the numbers?
Yes. Kafka stores batches as the producer compressed them, so we must make sure the measured rate is the compressed rate on disk. If we only know the uncompressed rate, we estimate the compression ratio from a sample of real data.
7Conclusion
In this answer, we estimated disk from the average rate because time-based retention keeps the last 7 days: 3 MB/s gives about 260 GB a day, 1.8 TB a week, 5.4 TB with three replicas, roughly 0.9 TB per broker. We added up to one extra segment per partition replica, headroom to keep disks below 60 to 70 percent for growth, skew and reassignments, about 20 percent more per survivor if a dead broker's replicas move, and the space other and internal topics already use, with retention.bytes as a safety cap.
Open with
Since retention is time-based, I size on the average rate, not the peak. 3 megabytes per second times 86,400 seconds is about 260 gigabytes a day, so about 1.8 terabytes for seven days, and with replication factor 3 about 5.4 terabytes across the cluster.
Then, if they want more
Spread evenly over six brokers that is roughly 0.9 terabytes per broker, and I would redo that with expected growth, say 50 percent more traffic next year. My assumptions are that 3 MB/s is the compressed rate on disk and that partitions are spread evenly. Then I add what the headline number misses.
Retention deletes whole closed segments, so each partition replica can keep up to an extra segment, 1 gigabyte by default, beyond seven days; with many partitions that adds up.
I leave headroom: many teams keep disks below 60 to 70 percent to absorb growth, uneven partitions and reassignments, which hold old and new replicas at the same time, and a full log directory takes that broker's partitions offline.
Kafka does not re-replicate automatically when a broker dies, so if I move a dead broker's replicas to the other five, each needs about 20 percent more.
Finally I count other topics and internal topics like consumer offsets, transaction state and Connect and Streams internals, and I might set retention.bytes as a safety cap if the volume is hard to predict.
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 "Estimate the disk it needs per broker, state your assumptions, and explain what else you...": https://scrivio-interview-library.netlify.app/spring-boot/kafka-operations/2d2f34a05f/