Cluster Scaling Strategies in Apache Kafka
A Kafka cluster that was perfect last year can struggle today. This guide explains how to tell when a cluster needs to grow, which levers to pull, how data moves safely between servers, and how to shrink or split clusters without losing sleep.
Picture a small neighborhood bakery. At first, one oven and two bakers are enough. Then a office building opens next door, orders triple, and the bakers start burning loaves. The owner could buy a bigger oven, hire more bakers, open a second shop, or change the recipe so each loaf bakes faster. Each choice fixes a different bottleneck, and picking the wrong one wastes money while the queue keeps growing. Scaling a Kafka cluster is the same puzzle, and this tutorial teaches you to read the symptoms before you reach for a fix.
Kafka scales well, but it does not scale by itself. Adding a server to a running cluster does not automatically make anything faster, and adding partitions can quietly break ordering guarantees. Understanding what each scaling move really does is the difference between a calm capacity upgrade and a stressful weekend incident.
1What Does It Mean to Scale Kafka?
Scaling is not one thing. It is a family of answers to different kinds of pressure.
Apache Kafka is a platform that stores and moves streams of events, such as payments, clicks, or sensor readings. A group of Kafka servers working together is a cluster, and each server in it is called a broker. Producers write events to the cluster, and consumers read them back. When we say a cluster must scale, we mean it must handle more of something without getting slower or less reliable.
The important word is something. Growth can arrive in several forms, and each form stresses a different part of the system. A cluster that handles a million small events per second may fall over when asked to store a year of history. A cluster that stores huge amounts of data may struggle when ten thousand consumers connect. Naming the pressure correctly is the first scaling skill.
A highway can be overloaded in different ways. Too many cars need more lanes. Too many trucks need stronger bridges. Too many entrance ramps need better traffic lights. Widening the road does not fix a weak bridge. In Kafka, throughput, storage, connections, and metadata are the lanes, bridges, ramps, and lights.
Throughput
How many bytes and events per second flow in and out of the cluster.
Storage
How much data must be kept on disk, driven by rate, retention time, and replication.
Partition Count
How many partitions exist in total, which affects metadata, recovery time, and file handles.
Client Connections
How many producers and consumers are connected, and how many requests they send.
Consumer Parallelism
How many application instances must read a topic at once to keep up with the flow.
Tenants and Teams
How many teams share the cluster, and how well one team’s burst is kept from harming others.
Most failed scaling projects start with the wrong diagnosis. Before choosing a strategy, decide which of the six dimensions is actually under pressure, and measure it.
2A Quick Tour of the Cluster You Are Scaling
You cannot scale what you cannot picture. Here is the minimum anatomy you need.
A topic is a named stream, such as orders. To spread the work, a topic is split into partitions, and each partition is an ordered log stored on disk. Every event in a partition has an offset, a sequence number that grows by one. Ordering is guaranteed only inside a single partition, not across the whole topic.
Each partition is stored on several brokers for safety. The number of copies is the replication factor, and a common choice is three. One copy is the leader, which handles all reads and writes for that partition, and the others are followers that copy the leader’s log. The followers that are fully caught up are called the in-sync replicas. If the leader fails, one of the in-sync followers takes over.
Think of a school with several classrooms. Each class register is a partition. Every register has a main teacher who writes in it, which is the leader, and two assistants who keep identical copies, which are the followers. If the main teacher is absent, an assistant with an up-to-date copy takes over.
The Controller and Cluster Metadata
Someone must decide which broker leads which partition, and record the answer. This work belongs to the controller. In older Kafka versions, the controller depended on a separate coordination service called ZooKeeper. Newer versions use a built-in quorum of controllers called KRaft, and modern releases have removed ZooKeeper entirely. Either way, the controller keeps the cluster’s metadata, meaning the list of topics, partitions, leaders, and configuration.
flowchart TD
P["Producers"] --> B1["Broker 1"]
P --> B2["Broker 2"]
P --> B3["Broker 3"]
B1 B2
B2 B3
B1 B3
B1 --> C["Consumer group"]
B2 --> C
B3 --> C
K["Controller quorum: metadata and leader decisions"] -.-> B1
K -.-> B2
K -.-> B3
Many people think a topic lives on one broker. It does not. A topic is spread across many brokers through its partitions, and this spreading is the entire basis of Kafka scaling.
3Reading the Signals: When Should You Scale?
Good scaling is triggered by evidence, not by hunches or anxiety.
A healthy cluster tells you when it is running out of room, if you know where to listen. The trick is to watch trends and headroom rather than waiting for failures. Scaling under pressure is riskier, because moving data adds load at exactly the moment the cluster is already struggling.
| Signal | What It Tells You | Likely Cure |
|---|---|---|
| Disk usage trending toward the limit | Storage is running out | Add brokers or disks, shorten retention, use tiered storage |
| Network utilization consistently high | Bandwidth is the bottleneck | Add brokers, compress data, reduce fan-out |
| Request handler threads rarely idle | Broker processing is saturated | Add brokers or larger machines, reduce request volume |
| Under-replicated partitions appearing | Followers cannot keep up | Check disks and network, rebalance load |
| Growing request queue and latency | Requests wait too long | Add capacity, spread leaders evenly |
| Consumer lag increasing steadily | Readers cannot keep pace | Add consumers, add partitions, optimize processing |
| One broker much busier than others | Uneven load | Rebalance partitions and leaders |
The Main Health Indicators
Request Handler Idle Percent
Shows how much of the time the threads that process requests are free. Consistently low idle time means the brokers are close to their limit.
Network Processor Idle Percent
Shows how busy the threads that move bytes over the network are.
Under-Replicated Partitions
Counts partitions whose followers are behind. A steady non-zero value signals stress or failure.
Produce and Fetch Latency
Shows how long clients wait for their requests, split into queue time, disk time, and network time.
Set alerts at a comfortable threshold, such as sixty percent of any resource limit, and treat the alert as the start of a planning conversation. If you wait until ninety percent, you must scale in a hurry.
Also watch growth, not just level. A cluster at fifty percent disk that is growing ten percent a month has a very different future from one that is stable. Multiply the growth rate by the time it takes your organization to buy hardware, get approval, and complete data moves. If that total is longer than the time until you hit the limit, you are already late.
4Vertical Scaling: Bigger Brokers
The simplest idea is to give each broker more power. It helps, but only up to a point.
Vertical scaling means upgrading the machines you already have: more processor cores, more memory, faster disks, or a faster network card. It is attractive because the architecture stays the same. The number of brokers does not change, and neither does the way partitions are placed.
Vertical scaling is replacing your bakery’s oven with a bigger, hotter one. Everything else stays the same, the same staff and the same shop. It works well until the shop’s front door becomes the limit, because customers cannot get in faster.
What Each Resource Buys You
Memory
Kafka leans heavily on the operating system’s page cache to serve recent data from memory instead of disk. More memory means more of the hot data stays cached, so consumers that read near the end of the log rarely touch the disk. Giving Kafka’s own program a huge memory area is usually less helpful than leaving room for the cache.
Disks
Kafka writes sequentially, which suits both spinning and solid-state disks, but faster disks help consumers that read old data and recovery operations that copy large logs. More disks per broker increase capacity and parallel throughput.
Network
Because each byte written is copied to followers and then read by consumers, network traffic is often several times the incoming rate. A faster network card raises the ceiling for all of that traffic.
Processor
Cores matter for encryption, compression, and handling many concurrent requests. Clusters using secure connections and heavy compression are often processor-bound before they are disk-bound.
Advantages
- No change to partition layout or client behavior
- Fewer machines to manage and monitor
- Quick relief for a resource that is clearly the bottleneck
- Often lower software and operational overhead
Disadvantages / Trade-offs
- Every machine is a larger failure domain when it goes down
- Recovery of a very large broker takes much longer
- Hardware has an upper limit, and prices rise steeply near it
- Upgrading usually needs a rolling restart of each broker
- Does not help when the real limit is partition count or metadata
Very large brokers create a hidden risk. If one broker holds a huge share of the data and it fails, rebuilding its copies onto another machine can take hours and saturate the network. Many teams prefer more medium brokers over a few giants for this reason.
5Horizontal Scaling: Adding Brokers
Adding brokers is Kafka’s natural way to grow, with one surprise that catches nearly everyone.
Horizontal scaling means adding more brokers to the cluster and spreading the work across them. It increases total throughput, storage, and network capacity together, and it does not run into a single machine’s ceiling. This is why Kafka is described as a scale-out system.
Now for the surprise. When you add a new broker to a running cluster, it joins the cluster but holds nothing. Existing partitions stay exactly where they were. The new broker will sit idle, while the old brokers stay as busy as before. Kafka does not automatically move data onto new servers, because moving data is expensive and it wants the operator to choose when.
Imagine a restaurant that hires three new waiters but never changes the table assignments. The new waiters stand by the kitchen, watching, while the old waiters remain overworked. Someone has to hand over some tables. Adding brokers is hiring, and reassigning partitions is handing over tables.
Prepare the new brokers
Give them unique identities, the same configuration standards, the right rack labels, and confirm that security settings and network access match the existing brokers.
Start them and confirm they joined
Check that the cluster metadata lists the new brokers and that they are healthy but empty of partitions.
Decide which partitions should move
Choose a target balance so that each broker carries a fair share of partitions, leaders, and bytes, considering racks and current load.
Move data gradually with limits
Reassign partitions in batches, with bandwidth limits that protect normal traffic, and watch health metrics between batches.
Rebalance leaders and verify the result
Make sure leadership is spread evenly, then confirm that load, latency, and lag look healthier than before.
Newly created topics are different. When a topic is created after the new brokers join, Kafka can place its partitions across all brokers, including the new ones. That is why some teams grow the cluster gradually just by letting new workloads land on the new machines. However, existing hot topics still need to be moved explicitly.
Add brokers in advance of need, not in the middle of an emergency. Moving data to a new broker uses the same network and disks that your production traffic needs, so the best time to expand is when the cluster still has room to spare.
6How Partition Reassignment Really Works
Moving a partition is a careful copy-then-switch dance, not a simple cut and paste.
Partition reassignment is the operation that changes which brokers hold a partition’s replicas. It is the workhorse of all horizontal scaling. Understanding its steps helps you predict its cost and avoid surprises.
Suppose a partition currently lives on brokers one, two, and three, and you want it on brokers one, two, and four. Broker four must first receive a full copy. It fetches the entire log from the current leader, just like an ordinary follower, and the amount of data can be huge for busy topics. During this phase the partition temporarily has four replicas, and the new one is not yet in sync.
Once broker four has caught up and joined the in-sync set, the controller removes broker three from the replica list. Broker three then deletes its now-unneeded copy. At no point during the move does the partition lose its safety, because the old copies remain until the new one is ready. That is the design’s great strength, and its cost is the temporary extra load.
sequenceDiagram
participant Op as Operator
participant Ctl as Controller
participant L as Leader broker
participant N as New broker
participant O as Old broker
Op->>Ctl: Request new replica placement
Ctl->>N: Become follower of the partition
N->>L: Fetch full log history
L-->>N: Stream data until caught up
N->>Ctl: Now in sync
Ctl->>O: Remove replica from the set
O->>O: Delete old copy
The Hidden Costs of Moving Data
Network Load
Every moved byte crosses the network at least once, and the leader must send it in addition to normal client traffic.
Disk Load
The leader reads old log segments that may not be in memory, which competes with consumers for disk time.
Cache Pollution
Reading old data for a copy can push recent, hot data out of the page cache, making normal reads slower.
Time
Terabytes at a throttled speed can take many hours or days, so moves must be planned as long-running operations.
Throttling and Batching
To protect production traffic, operators apply a replication throttle, which caps the bandwidth used for moving data. A low throttle is safe but slow, and a high throttle is fast but can hurt clients. The right value comes from watching latency during a small trial move. Operators also split a large rebalance into batches, finishing and checking each one before starting the next.
Forgetting to remove a throttle after a move finishes leaves a permanent speed limit on replication. Later, when a broker restarts and its followers need to catch up, they crawl. Always clear temporary throttles once the work is done and confirm that they are gone.
7Choosing and Changing Partition Counts
Partitions are the unit of parallelism, so getting their number right is the most important scaling decision.
Partitions decide how widely a topic’s work can be spread. A partition is handled by one leader at a time and read by only one consumer in a group at a time. Therefore, the number of partitions caps both how many brokers can share a topic’s load and how many consumer instances can read it in parallel.
Partitions are like checkout lanes in a supermarket. With two lanes, at most two cashiers can work, no matter how many you hire. With twenty lanes, twenty cashiers can work, but you also need enough floor space, tills, and managers to run twenty lanes.
A Simple Way to Size a Topic
A well-known method is to measure the throughput a single partition can deliver on the producing side and on the consuming side. Then divide the target throughput by each number and take the larger result. For example, if a partition can accept ten megabytes per second from producers, but a consumer can process only five megabytes per second from a partition, and the goal is a hundred megabytes per second, you need at least twenty partitions because the consuming side is the limit. Add headroom for growth so that you do not need to change the count soon.
Increasing Partitions Later
Kafka allows the partition count of an existing topic to be increased. It does not allow it to be decreased. Growing a topic seems harmless, but it has an important side effect for keyed data. Events with the same key are normally placed in a partition chosen by a formula that depends on the number of partitions. When that number changes, the formula sends the same key to a different partition. New events for a key may land somewhere different from its old events, so ordering for that key is no longer guaranteed across the change.
Problem
A team starts a keyed topic with very few partitions to save effort, then adds partitions later when consumers fall behind.
Why It’s Harmful
Adding partitions changes where new events for each key go. Applications that rely on all events for a key living in one ordered log, such as account balances or state machines, may process events out of order or split state across consumers.
Correct Approach
Size keyed topics generously at creation, with room for years of growth. If growth beyond that is needed, create a new topic with more partitions and migrate producers and consumers in a planned cutover.
Benefits of More Partitions
- Higher potential producer and consumer parallelism
- Load spreads across more brokers
- Smaller partitions are easier to move
- More room for future consumer growth
Costs of More Partitions
- More files and open handles on every broker
- More metadata for the controller to manage
- Longer recovery after a broker or controller failure
- More replication traffic and more memory for buffers
- Slightly higher end-to-end latency in some workloads
More is not always better. Older guidance for clusters that used ZooKeeper recommended keeping partitions per broker within a few thousand, and newer metadata systems raise those limits considerably. Check the guidance for your exact version, and load test with realistic counts rather than trusting a single number.
8Scaling Storage: Retention, Disks, and Tiered Storage
Sometimes the cluster is fast enough but simply too full.
Storage need is easy to predict. It equals the data rate, multiplied by the retention time, multiplied by the replication factor, with headroom on top. Each of those terms is a lever. You can store less by reducing the rate, shortening retention, lowering replication for non-critical topics, or compressing data. You can store more by adding disks, adding brokers, or moving old data to cheaper storage.
Levers That Reduce Storage Pressure
Shorter Retention
Many topics keep data far longer than any consumer needs. Reviewing each topic’s real replay needs can free large amounts of space without buying anything.
Compression
Producers can compress batches before sending. Compression reduces disk use and network traffic together, at the cost of some processor time, and it works best with larger batches of similar data.
Compaction
For topics that represent the latest state per key, log compaction keeps only the newest value for each key and removes older ones, sharply reducing size over time.
Right-Sized Replication
Critical data needs several copies. Scratch or easily rebuilt data may not, and lowering its replication factor reduces storage and network cost, though it also reduces safety.
Tiered Storage
Tiered storage is a feature that separates recent data from old data. The newest segments stay on the brokers’ local disks for fast access, while older segments are copied to a cheaper, larger remote store such as object storage. Consumers reading recent data are unaffected, and consumers replaying old data read from the remote tier, usually with higher latency. It became production-ready in recent Kafka releases, but availability and limits depend on the version and on the plugin used for the remote store.
Tiered storage is like a desk and a warehouse. Papers you need this week stay on the desk. Older files go to the warehouse across town. You can still get them, but it takes longer, and your desk never overflows.
Advantages
- Long retention without buying more broker disks
- Brokers hold less local data, so moves and recovery are faster
- Storage and compute can be sized separately
- Lower cost per stored byte
Trade-offs
- Reading old data is slower than reading local data
- Adds a new dependency on the remote store
- Some features and topic types have limits
- Needs extra monitoring of upload and read behavior
9Network, Replication Factor, and Rack Awareness
The network often runs out before the disks do, because one byte in becomes many bytes moving.
Every byte a producer writes is copied to each follower, and then may be read by every consumer group. If the replication factor is three, one megabyte in creates two megabytes of copying between brokers. If four separate consumer groups read the topic, that megabyte is sent out four more times. A modest-looking ingress rate can therefore produce many times as much total traffic.
A newspaper prints one edition, but sends copies to two backup printing plants and then to every subscriber. The single page created at the start turns into a small fleet of trucks. The trucks, not the printing press, may be what limits the business.
Rack Awareness
Brokers can be given a rack label, which usually represents a zone or a power and network failure domain. When rack awareness is used, Kafka spreads a partition’s copies across different racks. A failure of one rack then never removes all copies of a partition. As you add brokers, keep the racks balanced. Adding five brokers to one rack and none to the others weakens this protection and makes some racks carry more traffic.
Fetching From the Nearest Replica
Normally consumers read from the leader. In clusters spread across zones, that means traffic often crosses zone boundaries, which costs money and adds delay. A feature called follower fetching lets consumers read from a nearby follower instead. It reduces cross-zone traffic and spreads read load, at the price of very slightly older data, because followers trail the leader by a small amount.
When estimating network need, multiply the incoming rate by the replication factor minus one, add the incoming rate multiplied by the number of consumer groups, and keep the total below about half of the network card’s capacity for safe headroom.
| Choice | Safety | Network Cost | Typical Use |
|---|---|---|---|
| Replication factor 1 | No protection from a broker loss | Lowest | Disposable test data only |
| Replication factor 2 | Survives one broker loss | Moderate | Less critical streams |
| Replication factor 3 | Survives two losses, common default | Higher | Most production topics |
| Rack-aware factor 3 | Survives a whole rack loss | Higher, with possible cross-zone cost | Regulated or critical systems |
10Scaling the Consumer Side
A cluster can be perfectly healthy while consumers still fall hopelessly behind.
Consumer lag is the gap between the newest event in a partition and the position the consumer group has reached. When lag grows steadily, the readers are slower than the writers. The fix depends on why. It might need more consumer instances, more partitions, faster processing code, or a fix to a slow downstream system that consumers call.
Within a consumer group, each partition is assigned to at most one member. If a topic has twelve partitions, then twelve members can work in parallel, and a thirteenth member sits idle. Adding consumers beyond the partition count gives no speedup. This is the reason partition count planning is tied so closely to consumer scaling.
Think of a mail room with twelve mailboxes. Each mailbox is read by exactly one clerk at a time. Twelve clerks can work at once. A thirteenth clerk has no mailbox to empty, and so stands around, even though there is plenty of mail.
What Happens When the Group Changes
When a member joins or leaves, the group must redistribute partitions. This is called a rebalance. Older rebalancing behavior paused every member while the work was reshuffled, which caused visible stalls in large groups. Newer approaches improve this. Cooperative rebalancing moves only the partitions that need to move, and static membership lets a restarting member reclaim its old assignment without a full reshuffle. Recent Kafka versions also introduce a redesigned group protocol that moves much of the coordination to the brokers and reduces stop-the-world pauses.
More Instances
Add consumers up to the partition count. This is the quickest fix when partitions are not yet all in use.
More Partitions
Raise the ceiling of parallelism when all partitions already have a consumer, mindful of key ordering effects.
Faster Processing
Batch downstream calls, avoid per-event network round trips, and remove slow work from the read loop.
Internal Parallelism
Hand events from one consumer to a worker pool, preserving per-key order, when a partition’s work is heavy.
Scaling consumers during a lag spike can trigger a rebalance, which briefly pauses reading and makes the lag worse before it gets better. Where possible, add capacity using stable, gradual steps and use the modern rebalancing options.
11Scaling the Producer Side
Well-behaved producers can double the useful capacity of a cluster without buying anything.
Producers decide how efficiently data arrives. A producer that sends every event alone creates a flood of tiny requests, and each request has overhead. A producer that groups events into batches sends far fewer requests and uses network and disk much more efficiently. Because this cost is paid by every broker on every request, small changes in producer behavior have large effects on the cluster.
Batch Size
Controls how many bytes are collected per partition before sending. Larger batches improve throughput and compression.
Linger Time
Tells the producer to wait a few milliseconds so that batches can fill. A small delay often brings a large efficiency gain.
Compression
Shrinks batches before they travel, saving network and disk at the cost of some processor use.
Acknowledgement Level
Defines how many replicas must confirm a write. Stronger settings are safer but add wait time.
Delivering letters one by one by taxi is expensive. Waiting a few minutes to fill a van with letters for the same neighborhood costs far less per letter. Batching and linger time turn many small trips into one efficient trip.
Protecting the Cluster With Quotas
One misbehaving application can consume all the bandwidth of a shared cluster. Kafka supports quotas that limit the bytes per second a client or user may send or receive, and the share of request processing time they may use. When a client goes over its quota, the broker slows its responses, which pushes back on the client. Quotas are a scaling tool because they let a cluster serve many tenants fairly without buying capacity for the worst case of each one.
Set default quotas for all clients and grant larger quotas to those with a proven need. A default protects you on the day someone deploys a new application with a bug.
12Automation and Balancing Tools
Moving thousands of partitions by hand is slow and error-prone. Tools exist for a reason.
In a cluster with a handful of topics, an operator can decide by hand which partitions go where. In a cluster with thousands of partitions and changing traffic, that quickly becomes impractical. Balancing tools examine the load on every broker, then propose a set of moves that improves the distribution while respecting rules such as rack placement and disk limits.
Cruise Control
An open-source project created at LinkedIn that continuously collects load metrics, builds a model of the cluster, and generates rebalance proposals against goals such as even disk use, even network use, and rack awareness. It can also help when adding or removing brokers by moving partitions on or off them.
Kubernetes Operators
Projects such as Strimzi run Kafka on Kubernetes and can integrate with balancing tools. They automate rolling restarts, broker additions, and configuration changes, following safe orders that avoid taking too many replicas offline at once.
Managed Services
Cloud providers and vendors offer hosted Kafka where scaling is a setting, and rebalancing happens behind the scenes. This removes work but also removes some control, and each service has its own limits and pricing model.
What Balancing Goals Usually Cover
Disk Balance
Keep every broker’s disk use within a similar range so none fills first.
Network Balance
Spread inbound and outbound traffic so no single broker’s network card is the weak point.
Leader Balance
Distribute leaders evenly, because leaders do most of the client-facing work.
Rack Constraints
Never place all replicas of a partition in one failure domain.
Automation amplifies both good and bad decisions. An unlimited automatic rebalance can flood the network. Always review proposals, apply limits on concurrent moves, and start with smaller changes until you trust the results.
13Scaling the Control Plane: ZooKeeper and KRaft
The data plane moves events, but the control plane decides who does what. It can become a limit too.
The control plane keeps the cluster’s metadata and coordinates leader elections. In the classic design, a separate ZooKeeper ensemble stored this information, and one broker acted as the controller that read it. When a broker failed, the controller had to load a large amount of metadata and update many partitions, so recovery time grew with the number of partitions.
The newer KRaft design moves metadata into a Kafka-native log managed by a small quorum of controller nodes. Metadata changes become ordinary log events that brokers read and apply, which makes failover much faster and raises the practical limit on partition counts. Recent Kafka releases have removed ZooKeeper mode entirely, so new clusters use KRaft.
The old design is like a city hall where every change of street sign must be looked up in a separate archive across town. The new design keeps a running notebook right in city hall, so any official can catch up quickly by reading the latest pages.
Sizing the Controller Quorum
The controller quorum is usually three or five nodes. More nodes do not make the control plane faster, because every metadata change must be agreed by a majority. They only allow more failures to be tolerated. Three nodes survive one failure, and five survive two. The load on controllers grows with the number of partitions and brokers, and with the rate of metadata changes, so very large clusters give the controllers well-provisioned machines and fast disks.
| Aspect | ZooKeeper Mode | KRaft Mode |
|---|---|---|
| Metadata storage | External ZooKeeper ensemble | Internal Kafka log on controller nodes |
| Controller failover | Reloads metadata, slower with many partitions | Standby controllers already hold metadata, much faster |
| Partition scaling limit | Lower practical ceiling | Substantially higher ceiling |
| Systems to operate | Two separate systems | One system |
| Status in current releases | Removed in recent major versions | The standard mode |
If you still run a ZooKeeper-based cluster, a migration to KRaft is itself a scaling project. It removes an entire tier to operate and lifts the partition ceiling, but it needs careful planning and testing in your environment.
14Scaling Down: Removing Brokers Safely
Shrinking a cluster is harder than growing it, because you must empty a broker before you switch it off.
Sometimes traffic falls, a project ends, or costs must be cut. Removing a broker is not as simple as shutting it down. If you stop a broker that still holds the only in-sync copy of some partitions, those partitions become unavailable or lose data. The safe order is to move every replica off the broker first, wait until all partitions are fully in sync elsewhere, and only then stop it.
Check remaining capacity
Confirm that the remaining brokers have enough disk, network, and processing room for the load that the leaving broker carried.
Plan a drain
Create a reassignment plan that moves every replica away from the broker, respecting racks and balance on the remaining brokers.
Execute in throttled batches
Move partitions gradually, watching latency and under-replicated partitions between batches.
Verify the broker is empty
Confirm that it leads and replicates nothing, and that all affected partitions are fully in sync.
Stop and unregister it
Shut it down cleanly, remove it from the cluster’s active set, and update monitoring, security rules, and documentation.
Removing several brokers at the same time can take too many replicas of the same partition offline together, dropping below the minimum in-sync setting and blocking writes. Remove one broker at a time, or a carefully planned set, and verify health after each.
15When to Split Into More Clusters
A bigger cluster is not always the better answer. Sometimes the right move is another cluster.
Kafka clusters can grow large, but there are good reasons to run several. A single huge cluster has a huge blast radius. A software bug, a bad configuration, or a runaway client can affect every team that shares it. Separate clusters give stronger isolation, simpler capacity planning per group of workloads, and independent upgrade schedules.
Blast Radius
Critical systems are separated from experimental ones, so a mistake in one cannot disrupt the other.
Workload Shape
High-throughput analytics streams and low-latency transaction streams have different tuning needs.
Geography and Compliance
Data may have to stay in a region, or be served close to users, which calls for regional clusters.
Organizational Boundaries
Different business units may want separate budgets, upgrade schedules, and ownership.
Metadata Limits
Very large partition counts can strain the control plane, so splitting keeps each cluster in a comfortable range.
Advantages of Multiple Clusters
- Smaller failure domains and faster recovery
- Independent upgrades and tuning
- Clearer cost attribution per team
- Easier compliance boundaries
Disadvantages / Trade-offs
- More systems to run, monitor, and secure
- Cross-cluster data sharing needs replication tools
- Consumer positions do not automatically carry over between clusters
- Duplicated tooling and expertise requirements
The trade-off is real. Once data must cross clusters, you take on the challenges of mirroring, such as extra delay, replay after failover, and offset differences between copies. Splitting is a strong tool, but it should be chosen for clear reasons rather than as a reflex.
16Elasticity, Kubernetes, and the Limits of Autoscaling
Web servers scale up and down with traffic in minutes. Kafka brokers cannot, and the reason is data.
Stateless services can be started and stopped freely because they hold nothing important. Kafka brokers are stateful. Each one holds partitions of data on its disks. Adding a broker only helps after data has been moved to it, and removing one requires draining it first. Both operations take time proportional to the amount of data, which can be hours, not seconds.
Adding a waiter to a restaurant takes a minute. Adding a new warehouse to a supply chain takes weeks, because goods must be trucked there. Kafka brokers are more like warehouses than waiters.
Running Kafka on Kubernetes
Kubernetes can manage Kafka, but brokers need stable identities, persistent disks that follow them, and careful restart ordering. Operators automate these steps. A pod restart must not remove too many replicas at once, and a moved pod must reattach to the same disk. Storage performance and network topology in the cluster matter greatly, since a broker sharing a node with noisy neighbors will suffer unpredictable latency.
What Can Be Elastic
Client Applications
Producers and consumers are usually stateless and scale easily with load, within the partition limits discussed earlier.
Tiered Storage Capacity
Remote storage grows without limits or moves, so long retention no longer forces broker growth.
Scheduled Capacity
If load is predictable, such as heavy on weekdays, adding capacity ahead of a known peak is more reliable than reacting to the peak.
Configuring an automatic scaler to add and remove brokers based on short-term load can cause constant data movement, which itself creates load. Broker capacity should change deliberately, on slower cycles, with humans or well-tested automation in control.
17A Worked Capacity Planning Example
Numbers make the ideas concrete. Here is a small, invented example that you can adapt.
Imagine a platform that expects to receive one hundred megabytes per second of data on average, with peaks at twice that. Topics use a replication factor of three, and three separate consumer groups read most of the data in real time. Data must be kept for seven days. This is an invented scenario for practice, not a recommendation for any real system.
Step One: Storage
One hundred megabytes per second is about 8.6 terabytes per day. Over seven days, that is roughly sixty terabytes of unique data. With three copies, the cluster must hold about 180 terabytes. Leaving forty percent free for safety, growth, and maintenance operations, the disk needed is about 300 terabytes across the cluster.
Step Two: Network
Each byte received is copied to two followers, so replication adds two hundred megabytes per second of traffic between brokers. Three consumer groups read the data, adding three hundred megabytes per second going out to clients. That is five hundred megabytes per second of outgoing traffic in total on average, and about a thousand at peak. Spread across brokers, each broker must stay well below the capacity of its network card.
Step Three: Choosing the Broker Count
Suppose each candidate broker has thirty terabytes of usable disk and a ten gigabit network card, which is about twelve hundred megabytes per second in theory and about half that as a comfortable working target. Storage points to about ten brokers. Network at the peak of a thousand megabytes per second, with each broker targeting six hundred, points to two brokers at minimum, but the brokers must also receive their share of incoming and replicated traffic, and a failure of one broker must not overload the rest. Considering these together, twelve brokers is a reasonable starting design, giving room to survive the loss of a broker or a rack.
| Resource | Requirement | Result of Sizing |
|---|---|---|
| Disk | About 300 TB with headroom | At least 10 brokers at 30 TB each |
| Network | About 1,000 MB/s outgoing at peak | Fits easily across many brokers |
| Failure tolerance | Survive one broker or rack loss | Add spare capacity, so 12 brokers |
| Partitions per hot topic | Consumer-limited throughput | Use measured per-partition rates and add headroom |
Replace the invented numbers with your own measured rates, then re-run the calculation every quarter. The goal is not exactness. It is to notice which resource will run out first and to act well before it does.
18Monitoring and Security While Scaling
Scaling operations are risky moments, so you need sharper eyes and tighter controls.
What to Watch During a Scaling Operation
Client Latency
Produce and fetch latency should stay close to normal during data moves. Rising latency means the move is too aggressive.
Under-Replicated Partitions
A short rise while new replicas catch up is normal, but a lasting rise means trouble.
Disk and Network Headroom
Moves use both. Watch that no broker approaches its limit while the operation runs.
Consumer Lag
Lag that grows during the operation shows that reads are being starved.
Leader Distribution
After moves, leaders may cluster on a few brokers. Confirm they are spread evenly.
Controller Health
Large reassignments create many metadata changes, so confirm the control plane stays responsive.
Logging and Records
Keep a written log of every scaling action: what changed, when, who approved it, the throttle values, and the observed effects. These logs help the next person plan better, and they are invaluable when reviewing an incident after the fact.
Security Considerations
New brokers must meet the same security standards as old ones. That includes encrypted connections with valid certificates, correct authentication settings, and access rules that allow the brokers to talk to each other. Encryption also has a scaling cost, because it uses processor time, so capacity plans for secure clusters must include it. Operators who run reassignments need strong permissions, and those permissions should be limited, audited, and removed when no longer needed, since a mistaken move can harm the whole cluster.
Temporary shortcuts, such as opening network rules wide to speed up an emergency expansion, tend to become permanent. Record every temporary exception with an owner and a removal date.
19Design Patterns and Anti-Patterns
The same successes and mistakes repeat across organizations.
Pattern: Grow Before You Must
Keep permanent headroom, so that an expansion is a planned project rather than a reaction. Many teams treat sixty percent of any resource as the trigger to begin planning.
Pattern: Small, Repeated, Rehearsed Changes
Frequent small expansions with a well-tested procedure are safer than rare, large ones. The team also stays practiced at the procedure.
Pattern: Generous Partitions for Keyed Topics
Decide partition counts with years of growth in mind, so that ordering-sensitive topics never need to change their count.
Pattern: Quotas as Guardrails
Default quotas for every client protect shared clusters from accidents, and let teams request more capacity through a clear process.
Pattern: Isolate by Criticality
Keep vital systems on clusters that are separate from experiments and bulk analytics, so scaling problems in one world do not spread.
Problem
The team adds brokers during an incident and expects the load to drop immediately.
Why It’s Harmful
New brokers are empty, so nothing improves until partitions are moved. The move itself adds load to the already-struggling brokers, and can make the incident worse.
Correct Approach
Provide capacity in advance. During an incident, first reduce load through quotas or traffic shedding, then perform throttled, carefully monitored reassignments.
Problem
Every topic is created with a very large partition count, just in case.
Why It’s Harmful
Thousands of unneeded partitions slow recovery, consume memory and file handles, and push the cluster toward its metadata limits, all for no throughput benefit.
Correct Approach
Size each topic from measured throughput with reasonable headroom. Reserve very high counts for the few topics that truly need them.
Problem
The team runs one enormous, shared cluster for every workload and team with no quotas.
Why It’s Harmful
Any single noisy application can degrade every other one, and any cluster-wide incident affects the entire company at once.
Correct Approach
Introduce quotas, isolate critical workloads onto separate clusters, and give teams visibility into their own usage.
20Best Practices and Common Mistakes
A checklist can prevent most painful surprises.
Best Practices
- Measure first, and identify which resource is truly limiting
- Keep at least forty percent headroom on disks and network
- Use rack awareness and keep racks balanced as you grow
- Throttle every reassignment and move in small batches
- Size keyed topics generously at creation
- Apply default quotas to all clients
- Rehearse expansion and removal procedures on a test cluster
- Document every scaling action and its result
Common Mistakes
- Assuming new brokers take load automatically
- Adding partitions to keyed topics without considering ordering
- Leaving replication throttles in place after moves
- Scaling only brokers when consumers are the real bottleneck
- Ignoring the control plane as partition counts climb
- Removing brokers without draining them first
- Using giant brokers that take many hours to recover
- Waiting until a resource is nearly exhausted
Before any scaling change, ask three questions. What limit am I hitting, how will this change move that limit, and what could this operation itself break? If you cannot answer all three, gather more information first.
21Real-World and Industry Context
The same scaling questions appear in very different businesses.
Kafka began at LinkedIn, where it was built to move enormous streams of activity data, and much of today’s balancing and capacity practice comes from operating clusters at that scale. Since then, organizations in banking, retail, telecommunications, logistics, and gaming have adopted it, each with different pressures. Some care most about storage over long periods, others about millisecond latency, and others about serving many internal teams safely on shared infrastructure.
Financial Services
Safety and predictable latency matter most. Teams choose rack-aware replication, generous headroom, isolated clusters for critical payment flows, and strict change procedures with rehearsals.
E-Commerce and Retail
Traffic has sharp seasonal peaks. Teams often add capacity ahead of known events, use quotas to protect key flows, and scale consumers aggressively while keeping brokers on a slower, planned cycle.
Telemetry and Internet of Things
Enormous volumes of small events arrive constantly. Compression, batching, and tiered storage are central, because raw volume and retention costs dominate.
Shared Platform Teams
Central teams offering Kafka to many product teams rely on quotas, self-service topic creation with partition limits, and usage dashboards so that each tenant sees and controls its own consumption.
22Frequently Asked Questions
No. A new broker starts empty and shares no load until partitions are reassigned to it. New topics may use it right away, but existing topics stay where they are.
No. Kafka only allows increasing partitions. To reduce them, create a new topic with fewer partitions and migrate producers and consumers to it.
It is possible but changes which partition new events for a key land in. Anything that depends on strict ordering per key may be affected during and after the change, so plan carefully or use a new topic.
Measure how much a single partition can handle on the producing and consuming sides, divide the target throughput by each figure, take the larger result, and add headroom for growth.
A group cannot use more consumers than there are partitions. Extra members sit idle. Add partitions or use fewer members, and consider whether the busy partitions are unevenly loaded because of skewed keys.
Both extremes have risks. Very large brokers take long to recover and enlarge the failure impact. Very many tiny brokers add operational overhead. Many teams choose a middle path of medium brokers, sized so that losing one is manageable.
Use a replication throttle, move in small batches, watch latency and under-replicated partitions between batches, and do it during quieter periods when possible.
It lets brokers keep only recent data locally and place older data on cheaper remote storage, so retention can grow without adding broker disks, and broker moves and recoveries deal with less local data.
Not usually. Three or five controller nodes are typical. More nodes only add fault tolerance and do not speed up decisions. Very large clusters instead give the controllers strong machines and fast disks.
Clients can, brokers cannot easily. Brokers hold data, so adding or removing them requires moving data, which takes time and load. Plan broker capacity on slower, deliberate cycles.
Drain it by reassigning all its replicas to other brokers, wait until every affected partition is fully in sync, verify it holds nothing, and then shut it down. Remove one broker at a time.
When you need stronger isolation, different tuning for different workloads, regional placement, independent upgrade schedules, or when a single cluster’s metadata load is nearing comfortable limits.
Treating scaling as adding machines without diagnosing the real bottleneck. If consumers, partitions, network, or a client bug is the limit, extra brokers alone will not help.
A widely used habit is to plan expansion when any main resource reaches about sixty percent, leaving room for peaks, failures, and the extra load of data movement itself.
23Summary and Key Takeaways
Scaling a Kafka cluster is a chain of small, well-understood decisions. First, find which dimension is under pressure: throughput, storage, partition count, connections, consumer parallelism, or shared use by many teams. Then choose the lever that matches, whether that is bigger brokers, more brokers, better partition design, tiered storage, better client behavior, quotas, or a separate cluster. Finally, carry out the change slowly and with measurement, because moving data is itself a source of load and risk.
The most reliable teams keep generous headroom, size partitions carefully at creation, automate with limits and reviews, and rehearse their procedures. They know that new brokers start empty, that partitions can grow but never shrink, and that consumers cannot outnumber partitions usefully. With that knowledge, scaling becomes a routine part of running Kafka instead of a crisis.
Key Takeaways
- Diagnose before you scale — identify whether disk, network, processing, partitions, consumers, or metadata is the real limit.
- New brokers start empty — capacity only helps after partitions are reassigned, so plan and throttle the data movement.
- Partitions are one-way — they can be increased but not reduced, and changing the count affects key ordering, so size topics with growth in mind.
- Consumers are capped by partitions — extra group members beyond the partition count sit idle.
- Storage has many levers — retention, compression, compaction, replication choices, and tiered storage all change how much must live on broker disks.
- Control plane and clusters matter — KRaft raises partition ceilings, and separate clusters reduce blast radius when one cluster grows too large.
- Keep headroom and rehearse — start planning at about sixty percent utilization, use quotas, monitor closely during moves, and practice expansion and removal.