Scrivio Interview library
DesignAdvanced7 min read · updated 13 November 2026

You run a shared Kafka platform for 120 teams: 4 clusters, 60 brokers, 45,000 partition replicas, with traffic growing about 6 percent a month. Two outages last year came from disks filling up and from a cluster with too many partitions per broker.

Design the capacity model and process: what you measure, which headroom rules you set, and when you add brokers or split clusters.

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.

The capacity signals
SignalWhere it comes fromLimit we compare with
Disk used and growth per dayHost metrics per log directoryDisk ceiling (stricter than others)
Bytes in, bytes out, replication bytesBrokerTopicMetrics, host NICTested network and disk throughput
Request handler and network idleRequestHandlerAvgIdlePercent and friendsIdle should stay above about 0.3
Disk reads (page-cache misses)Host I/O metricsReads rising with lagging consumers
Partition replicas per brokerReplicaManager PartitionCountLimit from recovery-time tests
Metadata size and controller loadKRaft metadata and controller metricsController CPU, snapshot size
Each measure is paired with the limit it is judged against.

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.

Properties
# headroom check for one cluster, run monthly
zones = 3
survivor_factor = zones / (zones - 1) # 1.5
ceiling = 1.0 / survivor_factor # 0.666 of tested capacity
planning_limit = 0.60 # leave room for re-replication
peak_network_util = 0.52 # busiest broker at evening peak
print(peak_network_util <= planning_limit) # True: fits with a zone lost

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.

Java
public class PlatformTopicPolicy implements CreateTopicPolicy {
private static final int MAX_PARTITIONS = 64;
@Override public void configure(Map<String, ?> configs) { }
@Override
public void validate(RequestMetadata req) throws PolicyViolationException {
Integer partitions = req.numPartitions(); // null when explicit assignments are given
if (partitions != null && partitions > MAX_PARTITIONS) {
throw new PolicyViolationException("at most " + MAX_PARTITIONS + " partitions per topic");
}
}
@Override public void close() { }
}
// server.properties: create.topic.policy.class.name=com.example.PlatformTopicPolicy
// kafka-topics.sh --create --topic t --partitions 500 -> PolicyViolationException: at most 64 partitions per topic

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.

Step throughMonthly capacity review
  1. Collect peak use per resourcebusiest broker, last 30 days
  2. Add declared team growthlaunches, migrations
  3. Compute runway per clustermonths until the planning limit
  4. Runway under 3 months?
    YesOrder brokers or disks, plan rebalanceNoRecord and review next month
  5. 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.

Grow or split
SituationChoiceReason
Limiting resource near the planning limitAdd brokersNo client change, quickest
One incident hits too many teamsSplitSmaller blast radius
Upgrades need weeks of coordinationSplitIndependent upgrade cadence
Slow restarts or controller load from metadataSplitLess metadata per cluster
Tenant needs other latency or complianceDedicated clusterDifferent 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.

What to say in the interviewAbout 90 seconds aloud

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/