Quick revision
The short answer
A capacity model for a shared Kafka platform measures every resource that can run out on a broker (disk, network and disk throughput, request and network threads, page cache, partition replicas and metadata), sets headroom rules so that peak load still fits after losing a broker or a zone, and caps partitions per broker and per topic. A monthly review forecasts growth against those limits and triggers expansion when about three months of runway remain; we add brokers by default and split clusters only when blast radius, upgrades or tenant needs demand it.
What to remember
In this answer, we saw that a capacity model starts with every resource that can run out on a broker, each measured against a tested limit. Headroom is set against failure, so peak load fits with a zone lost, which keeps steady utilisation near 60 percent, and disks get a stricter limit because a full disk takes partitions offline. Partitions are capped per broker from recovery tests and per topic with a pipeline check and a CreateTopicPolicy. A monthly review turns growth into runway and expands at about three months, and we add brokers by default and split clusters when the blast radius or tenant needs call for it.
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.
A capacity model for a shared Kafka platform measures every resource that can run out on a broker (disk, network and disk throughput, request and network threads, page cache, partition replicas and metadata), sets headroom rules so that peak load still fits after losing a broker or a zone, and caps partitions per broker and per topic. A monthly review forecasts growth against those limits and triggers expansion when about three months of runway remain; we add brokers by default and split clusters only when blast radius, upgrades or tenant needs demand it.
Background to this question
Kafka rarely fails because of one dramatic event. It fails because a disk filled up slowly while nobody looked, or because partitions crept up until a broker restart took twenty minutes. Both outages in the overview were capacity failures, and both were predictable. With traffic growing 6 percent a month, the load roughly doubles every year, so a platform that is comfortable today is in trouble in twelve months unless someone owns the numbers. In this answer, we will recap what limits a broker, decide what to measure, set headroom rules that survive failures, cap partitions, build the forecast and expansion trigger, and finally decide when to add brokers and when to split a cluster.
1A Quick Recap: What Can Run Out on a Broker
A Kafka broker stores partitions, the ordered logs that make up a topic. Each partition has several copies, called replicas, spread over brokers; with replication factor 3, one partition counts as three partition replicas. Our 45,000 replicas over 60 brokers average 750 per broker, but averages hide the busiest broker, and that is the one that fails first.
Several resources can run out independently. Disk fills with retained data. The network carries producer traffic, consumer traffic and replication, so one produced megabyte is written three times with replication factor 3. Request handler and network threads do the CPU work. The page cache, memory the operating system uses to keep recent data, lets consumers read without touching disk; lagging consumers miss it and compete with writes for disk. And each partition replica costs files, memory, recovery time and an entry in the metadata the controllers manage.
2What We Measure, Per Broker and Per Cluster
For each of those resources we need the current use, the limit and the growth rate. Use without a limit is a graph; use against a limit is a capacity signal. We collect per broker, because the busiest broker matters, and we measure throughput limits with a load test on our own hardware, because replication, TLS and compression change the effective numbers.
| Signal | Where it comes from | Limit we compare with |
|---|---|---|
| Disk used and growth per day | Host metrics per log directory | Disk ceiling (stricter than others) |
| Bytes in, bytes out, replication bytes | BrokerTopicMetrics, host NIC | Tested network and disk throughput |
| Request handler and network idle | RequestHandlerAvgIdlePercent and friends | Idle should stay above about 0.3 |
| Disk reads (page-cache misses) | Host I/O metrics | Reads rising with lagging consumers |
| Partition replicas per broker | ReplicaManager PartitionCount | Limit from recovery-time tests |
| Metadata size and controller load | KRaft metadata and controller metrics | Controller CPU, snapshot size |
3Headroom Rules That Survive a Failure
A broker that runs at 85 percent on a normal day is fine until one broker dies. Then its leaders and its traffic move to the survivors, followers re-replicate, and the cluster tips over at the worst moment. So the headroom rule is stated against failure, not against a normal day: peak load must still fit when we lose one broker, or, if we promise zone resilience, one whole zone.
The arithmetic is simple. With brokers spread evenly over three zones, losing a zone puts the load of three zones on two, so each survivor carries 1.5 times its normal load. If the limit is 100 percent of the tested capacity, normal utilisation must stay at or below 66 percent; we round down to 60 percent to leave room for the catch-up traffic of re-replication.
Disks get a stricter limit for two reasons. A full disk does not slow down gracefully like a busy network; the broker cannot append, and the partitions in that directory go offline. A planning limit around 50 percent and an alert well below full gives the on-call engineer hours, not minutes.
4Capping Partitions per Broker and per Topic
The second outage came from too many partitions per broker. Each replica adds work when a broker starts (log recovery and catching up), when leadership moves, and on the controllers that track it. The number that matters is how long a broker takes to come back and become fully in sync, and that depends on our hardware and data, so we measure it: restart a broker in staging with 2,000, 4,000 and 6,000 replicas and time how long until UnderReplicatedPartitions returns to 0. We then set the per-broker limit where recovery time is still acceptable; a few thousand replicas per broker is a common operating target, but our own test decides.
Per-broker limits are kept by planning, because Kafka has no switch that refuses a replica on a full broker. Per-topic limits, however, can be enforced at creation time. The provisioning pipeline checks requests first, and a CreateTopicPolicy plugin on the cluster rejects anything that bypasses the pipeline.
In KRaft clusters topic creation is decided by the controllers, so the policy class must be on their classpath and configured on them as well; check your version's documentation for exactly which nodes read the setting.
5Forecasting and the Expansion Trigger
Measurements tell us where we are; the forecast tells us when we hit the limit. At 6 percent a month, load grows by a factor of 1.06 to the power of 12, about 2.0, in a year. If a cluster's limiting resource sits at 50 percent against a 60 percent planning limit, it has about 3 months of runway, because 1.06 to the power of 3 is 1.19.
We combine the trend with what teams tell us. Each team declares expected growth and big launches in the provisioning catalogue, and the monthly capacity review compares the trend line with those declarations.
- Collect peak use per resourcebusiest broker, last 30 days
- Add declared team growthlaunches, migrations
- Compute runway per clustermonths until the planning limit
- Runway under 3 months?YesOrder brokers or disks, plan rebalanceNoRecord and review next month
- Check blast radius and tenantssplit instead of grow?
5 steps in order. Play them, or step through them one at a time.
Expansion is triggered by runway, not by an alert.
The key choice is the trigger. We expand when runway drops to about three months, not when an alert fires, because hardware purchases, cloud quota increases and data rebalancing all have lead times. Waiting for a crisis threshold means doing a large reassignment on an already hot cluster, which is exactly when it is most dangerous.
6Add Brokers or Split the Cluster?
Adding brokers is the default. Clients keep the same bootstrap addresses and topics, so nobody outside the platform team notices. New brokers start empty, so every expansion ends with a throttled reassignment, often planned by Cruise Control.
A cluster can still become too big in ways that more brokers do not fix. When one incident or upgrade affects 120 teams, or metadata slows failovers and restarts, the cluster has outgrown one failure domain. And some tenants need different latency, a compliance boundary or their own upgrade timing.
| Situation | Choice | Reason |
|---|---|---|
| Limiting resource near the planning limit | Add brokers | No client change, quickest |
| One incident hits too many teams | Split | Smaller blast radius |
| Upgrades need weeks of coordination | Split | Independent upgrade cadence |
| Slow restarts or controller load from metadata | Split | Less metadata per cluster |
| Tenant needs other latency or compliance | Dedicated cluster | Different promises |
7Follow-up questions
How do you decide the per-broker partition limit?
We test it. In a staging cluster with production-like hardware and message sizes, we load brokers with increasing numbers of replicas, kill and restart a broker, and time how long it takes until UnderReplicatedPartitions is back to 0 and leadership has rebalanced. The limit is the largest count where recovery fits our target, for example ten minutes, with a margin.
Why not just buy much bigger disks?
Bigger disks delay the disk problem but make recovery slower: a replaced broker must copy everything it held, and more data per broker means longer re-replication and a longer period with reduced redundancy. If the need is long retention rather than throughput, tiered storage, available in Kafka since 3.9 as production ready, keeps older segments in object storage and keeps local disks small.
8Conclusion
In this answer, we saw that a capacity model starts with every resource that can run out on a broker, each measured against a tested limit. Headroom is set against failure, so peak load fits with a zone lost, which keeps steady utilisation near 60 percent, and disks get a stricter limit because a full disk takes partitions offline. Partitions are capped per broker from recovery tests and per topic with a pipeline check and a CreateTopicPolicy. A monthly review turns growth into runway and expands at about three months, and we add brokers by default and split clusters when the blast radius or tenant needs call for it.
Open with
I would start by listing what can actually run out on a broker: disk, network and disk throughput including replication, request and network threads, page cache, and partition replicas and metadata.
Then, if they want more
For each I would track the busiest broker against a tested limit, not just an average. Then I would set headroom rules against failure. With three zones, losing one puts one and a half times the load on the survivors, so steady utilisation stays around 60 percent.
Disks get a stricter limit, around 50 percent planned, because a full disk takes partitions offline instead of just slowing down.
Since one of our outages was partition count, I would measure broker recovery time at different replica counts in staging and set a per-broker limit from that, typically a few thousand, and enforce per-topic limits in the provisioning pipeline with a CreateTopicPolicy plugin as a backstop.
For forecasting, 6 percent a month means doubling in a year, so a monthly review computes runway per cluster from the trend plus teams' declared growth, and we trigger expansion at about three months of runway because hardware and rebalancing take time. By default we add brokers, since clients do not notice, and follow with a throttled reassignment.
We split or add a cluster when the blast radius, upgrade coordination or metadata load gets too big, or when a tenant needs different latency, compliance or upgrade timing.
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 "Design the capacity model and process: what you measure, which headroom rules you set...": https://scrivio-interview-library.netlify.app/spring-boot/kafka-operations/7914e135b3/