Scrivio Interview library
DesignAdvanced7 min read · updated 13 November 2026

A team is planning hardware for a new high-throughput Kafka cluster and needs figures it can defend rather than guesses.

Size the brokers for a cluster that must accept 400 MB/s of produce traffic with replication factor 3, where most consumers stay within ten minutes of the head and a few batch jobs read up to a day back. How much memory, disk and network do you plan, and which OS settings matter?

At 400 MB/s with replication factor 3, the cluster writes 1.2 GB/s to disk and about 35 TB of new leader data per day, which becomes roughly 100 TB per day of disk across replicas. Ten minutes of data is about 240 GB of leader data, so we plan well over 700 GB of page cache across the cluster because followers' writes use cache too, while each heap stays at 6 to 8 GB. Network is usually the first limit, so we count produce, replication and every consumer group, keep NICs well under capacity, and tune the OS for a file-heavy server.

Why this question is asked

Sizing a Kafka cluster from rules of thumb works until the first broker failure or the first big replay. A team that can show the arithmetic, and the assumptions behind it, can defend its budget and knows which number to revisit when traffic changes. Interviewers ask this to see whether we can turn Kafka's internals into concrete hardware figures. In this answer, we will set out the inputs, then work through disk throughput, page cache memory, disk capacity and network, pick a broker count, and finish with the OS settings that matter.

1The Inputs and Assumptions

We have 400 MB/s of produce traffic (after compression, as it is stored), replication factor 3, most consumers within ten minutes of the head and a few batch jobs reading up to a day back. We need a few more assumptions, and we write them down so they can be challenged: say four consumer groups read everything, retention is three days, and the cluster must keep working with one broker down. For the arithmetic we will use twelve brokers and adjust if a number does not fit.

A useful habit is to calculate everything at the cluster level first and then divide by the broker count, adding headroom at the end. That keeps each step easy to check.

2Disk Throughput and Page Cache Memory

Every byte produced is written by the leader and by two followers, so disks across the cluster absorb 400 x 3 = 1.2 GB/s of writes, or about 100 MB/s per broker with twelve brokers. That is sequential writing, comfortable for NVMe drives and fine for a few good SSDs per broker.

For reads, we want consumers within ten minutes of the head to be served from the page cache, the kernel's memory copy of recent file data. Ten minutes of leader data is 400 MB/s x 600 s = 240 GB across the cluster. But followers write their copies through the page cache too, and those pages compete for the same memory, so the recent data actually present in cache is closer to 3 x 240 = 720 GB. We plan for about 1 TB of page cache cluster-wide to leave headroom for indexes and bursts.

Java
Writes : 400 MB/s x 3 replicas = 1.2 GB/s (100 MB/s per broker)
Cache, leader data: 400 MB/s x 600 s = 240 GB
Cache, all copies : 240 GB x 3 = 720 GB -> plan ~1 TB
Per broker (12) : 1 TB / 12 = ~85 GB of page cache
Machine RAM : 85 GB cache + 8 GB heap + OS -> 128 GB per broker

The heap stays at around 6 to 8 GB per broker. Kafka does not cache data on the heap, and a bigger heap would only steal memory from the page cache and lengthen GC pauses. The batch jobs reading a day back will come from disk no matter what; we handle them with quotas, or by giving them tiered storage, rather than buying a day of RAM.

3Disk Capacity

New leader data per day is 400 MB/s x 86,400 s = 34.6 TB, about 35 TB. With three replicas, that is about 104 TB of disk used per day. Retention multiplies it: three days needs about 311 TB, and we add 30 to 50 percent headroom for growth, uneven partitions and the space a broker needs while partitions move, which brings us to around 420 to 470 TB across the cluster, or roughly 35 to 40 TB per broker with twelve brokers.

This is where tiered storage changes the picture. If the team later wants 30 days, local disks would have to hold over 3 PB, but with tiered storage the brokers keep perhaps a day locally and object storage keeps a single copy of the rest. So for long retention we size local disks from local retention and size the remote store separately.

4Network: Usually the First Limit

Network is where Kafka clusters most often run out, because every consumer group multiplies outbound traffic. We count each flow separately.

Network per broker (12 brokers, 4 consumer groups)
FlowCluster totalPer broker
Produce in400 MB/s33 MB/s in
Replication in (2 followers)800 MB/s67 MB/s in
Replication out (leaders)800 MB/s67 MB/s out
Consumer reads (4 groups)1,600 MB/s133 MB/s out
Totalin 1.2 GB/s, out 2.4 GB/s100 MB/s in, 200 MB/s out
Outbound is double inbound here, and each extra consumer group adds another 400 MB/s.

200 MB/s is 1.6 Gbit/s, small for a 25 Gbit/s NIC. But averages lie: partition leadership is never perfectly balanced, batch jobs read in bursts, and when a broker fails its leaders move to the other eleven and their load rises by about 10 percent. During recovery, the replacement broker also has to copy its whole share of data. So we aim for normal peaks below about 40 to 50 percent of NIC capacity, and we check cloud instance limits, which are often lower than the nominal NIC speed for sustained traffic. If more groups arrive, network is the number to revisit first.

5The Resulting Plan and the OS Settings

Twelve brokers with 128 GB of RAM, a 6 to 8 GB heap, about 40 TB of NVMe or SSD each and 25 Gbit/s networking meet these figures with room to lose a broker. With fewer, larger brokers, each failure moves more load and takes longer to recover, so we usually prefer more medium-sized brokers.

A few OS settings matter for a server that streams files all day. We use XFS or ext4 mounted with noatime, so reads do not cause writes to update access times. We set vm.swappiness to 1, so the kernel does not swap out the JVM to make room for cache. We tune dirty page settings (for example vm.dirty_background_ratio around 5) so the kernel flushes steadily instead of in large stalls. And we raise limits: nofile to 100,000 or more, because each segment and socket holds a file descriptor, and vm.max_map_count well above the default of 65,530, because Kafka memory-maps index files for every segment.

Properties
# /etc/sysctl.d/90-kafka.conf
vm.swappiness = 1
vm.dirty_background_ratio = 5
vm.dirty_ratio = 60
vm.max_map_count = 262144
# /etc/fstab: data disks
/dev/nvme1n1 /var/kafka/data xfs defaults,noatime 0 0
# systemd unit for the broker
LimitNOFILE=200000

Finally, we validate the plan with a load test at expected peak and with one broker stopped, using kafka-producer-perf-test.sh and kafka-consumer-perf-test.sh, before committing to the order.

6Follow-up questions

Why plan page cache for follower data when consumers only read from leaders?

Because the kernel does not know which pages are leader data. Followers write their copies through the page cache just like leaders, and those pages take up memory until they are evicted. If we only planned 240 GB, recent leader pages would be evicted earlier than we expect. Follower fetching for consumers in other zones also makes follower pages useful.

How would the plan change with tiered storage and 30 days of retention?

Local disk would be sized for local retention, say one day plus a backlog buffer for segments not yet uploaded, about 104 TB plus headroom across the cluster. The remote store holds one copy of 30 days, about 1 PB, billed as object storage. The batch jobs reading a day back might then read from remote storage, which spares local disks but has higher latency. Memory and network figures stay mostly the same, with some extra outbound traffic for uploads.

What would you monitor to know the sizing still holds?

Disk read IOPS (should stay near zero for tail consumers), page cache hit ratio, network utilisation per broker at peak, request handler idle percentage, disk usage against retention, and producer and consumer latency. A rising disk read rate without a replay running means the cache is getting too small.

7Conclusion

In this answer, we sized the cluster from first principles: 1.2 GB/s of writes from three replicas, about 240 GB of leader data for ten minutes of cache and roughly three times that once follower copies are counted, about 35 TB of new data per day multiplied by replicas and retention plus headroom, and network counted flow by flow, with outbound consumer traffic as the likely first limit. The heap stays small, the OS is tuned for streaming files, and the plan is checked with a load test that includes a broker failure.

What to say in the interviewAbout 100 seconds aloud

Open with

I would start by writing down the assumptions, because the numbers depend on them: 400 MB/s after compression, replication factor 3, say four consumer groups, three days of retention, and the cluster must survive losing a broker.

Then, if they want more

Then I work it through. Disk writes: 400 times 3 is 1.2 GB/s across the cluster, about 100 MB/s per broker with twelve brokers.

Memory: ten minutes from cache is 400 MB/s times 600 seconds, about 240 GB of leader data, but followers write through the page cache too, so I plan closer to 720 GB and round up to 1 TB, roughly 85 GB of cache per broker, so 128 GB machines.

The heap stays at 6 to 8 GB, because Kafka caches in the OS, not the JVM. Disk: 400 MB/s is about 35 TB a day, times 3 replicas is about 104 TB a day, times three days plus 40 percent headroom is roughly 450 TB, so about 40 TB per broker.

If they want long retention, tiered storage changes that a lot. Network is often the first limit: produce in, replication in and out, plus each consumer group reading 400 MB/s, so with four groups each broker sends about 200 MB/s. I keep peaks under half the NIC so a broker failure is survivable.

For the OS: XFS with noatime, swappiness 1, steady dirty-page flushing, and high nofile and max_map_count limits. Then I load test, including with a broker down.

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 "Size the brokers for a cluster that must accept 400 MB/s of produce traffic with...": https://scrivio-interview-library.netlify.app/spring-boot/kafka-internals/2a1a376e5a/