Blog

Kafka Partition Rebalancing | Why It's Slow & How to Fix

Adding brokers to a hot Kafka cluster sounds like the responsible move. CPU is climbing, disk usage is uneven, leaders are concentrated on a few brokers, and the platform team wants more headroom before the next traffic spike. Then the reassignment starts, the fresh brokers sit mostly empty for longer than anyone wants, and the cluster spends the maintenance window copying logs instead of absorbing load.

That is the uncomfortable part of Kafka broker scaling: capacity does not become useful the moment a broker joins. Traditional Kafka binds partition data to broker-local storage, so a kafka partition rebalance is not a scheduler decision. It is a storage migration, a network event, an ISR synchronization process, and a traffic-shaping exercise happening inside the same production cluster it is supposed to protect.

Why Kafka rebalancing takes hours

If you searched for "kafka rebalancing slow" after watching a reassignment run into the night, the root cause is usually not a bad command. The command is exposing an architectural fact: in broker-local Kafka, changing ownership means moving bytes.

The Rebalance Accident Nobody Plans For

The most common accident starts with a good decision: add brokers before the cluster hits a hard limit. A team generates a reassignment plan, throttles the movement to protect producers and consumers, and watches the progress. At first this feels controlled. Then the hidden trade-off appears: if the throttle is high, reassignment competes with production traffic; if the throttle is low, the operation stretches across more maintenance windows.

Large clusters make this trade-off sharper because the data distribution problem is never perfectly even. Some topics carry hot partitions, some partitions have long retention, and some brokers hold a heavier mix of leaders. Moving "a few partitions" can mean moving a large share of retained bytes. Moving leaders without moving replicas can shift request load but leave storage imbalance untouched. Moving replicas solves the placement problem but creates the long copy path.

The operational risk is not limited to elapsed time. During reassignment, source brokers read old segments while serving normal traffic, destination brokers write incoming replica data while taking on future load, and the network carries both production requests and migration streams. Under-replicated partitions, ISR churn, consumer lag, and elevated tail latency can show up together, which is why experienced operators treat broker scaling as a planned operation rather than background housekeeping.

Two Different Things Get Called "Rebalance"

Kafka teams often use "rebalance" for two operations with different blast radii. The first is a consumer group rebalance: consumers join, leave, fail heartbeats, or change subscription patterns, and the group coordinator assigns topic partitions to active consumers. Apache Kafka's consumer rebalance protocol documentation describes this as group membership and assignment coordination; Kafka 4.0's next-generation protocol improves this path with incremental design that avoids a global synchronization barrier for the consumer group.

The second is partition reassignment across brokers. This is what happens when you use tools such as kafka-reassign-partitions.sh to change the replica placement for topic partitions. Apache Kafka's operations documentation exposes reassignment as an administrative operation, including execution and throttling options. This operation touches broker placement, replica movement, leader election, and storage distribution.

Consumer rebalance vs partition reassignment

The distinction matters because tuning consumer group behavior does not make broker-side partition data move faster. Static membership, cooperative assignors, and improved consumer protocols can reduce application-side disruption, but they do not remove terabytes from broker disks.

OperationWhat changesMain costTypical owner
Consumer group rebalanceWhich consumer reads each partitionCoordination pauses, offset handoff, application lagApplication or stream processing team
Partition reassignmentWhich broker hosts each replica and leaderData copy, disk I/O, network bandwidth, ISR catch-upKafka platform or infrastructure team
Leader balancingWhich broker serves reads and writes for a partitionRequest load movement, possible client routing changesKafka platform team

This is why "kafka rebalance time" is ambiguous in dashboards and incidents. A consumer rebalance measured in seconds can still hurt a latency-sensitive application. A broker-side reassignment measured in hours can be harmless if it is small and throttled well. The dangerous case is when the team expects the first kind of operation and gets the second.

Why Traditional Kafka Partition Reassignment Is Slow

Traditional Kafka follows a shared-nothing model: each broker owns local log segments for the partitions assigned to it. Replication gives durability and availability by storing partition replicas on multiple brokers. This design is robust and familiar, but it means a broker's identity is tied to the data it holds. When a replica is reassigned from broker A to broker B, broker B must fetch the partition data before it can become a healthy replica.

The copy path has several gates:

  • Existing log data has to move. The destination broker needs the retained log for the reassigned replica. More retained data means more bytes to copy, and the copy competes with normal reads and writes.
  • Replication has to catch up. A copied replica still needs to reach the leader's current log end offset before it can be considered in sync. Heavy write traffic keeps extending the target while migration is running.
  • Throttling protects production at the cost of time. Kafka supports reassignment throttles because unlimited migration can damage the workload you are trying to save. The throttle turns a risky burst into a longer background operation.
  • Leader movement changes traffic shape. After replicas are placed, leaders may need to move so the added brokers receive real request load. That step changes where producers and consumers send traffic.

A scenario model explains why "hours" appears so often in war rooms. If a reassignment needs to move D bytes of retained log data and the safe migration budget is B bytes per second after leaving room for production traffic, the lower bound is D / B. That lower bound excludes catch-up, throttling pauses, controller work, leader movement, broker restarts, and retries.

The formula is more useful than a universal benchmark because every real cluster has a different safe budget. Network headroom, disk type, compression ratio, topic retention, replica count, and write rate all change the answer. The structural point remains: as long as partition ownership implies local data ownership, reassignment time grows with data volume.

If a 100 TB partition placement change depends on copying 100 TB of broker-local data, the operation is bounded by storage and network physics before any Kafka tuning begins.

Why "Add Broker" Does Not Mean "Scale Now"

This is the part that surprises teams moving from stateless services to Kafka. In a stateless service, adding compute capacity can take effect as soon as traffic routing changes. In traditional Kafka, adding brokers creates empty destinations, and the cluster still needs partition reassignment to move replicas and leaders onto them.

That delay changes capacity planning behavior. Teams keep idle broker headroom because scaling during an incident is too slow. They avoid frequent scale-in because removing brokers requires draining their data. Over time, the platform becomes stable but heavy, with capacity sized for the worst moment the team cannot react to quickly.

Kafka operators have practical mitigations, and they are worth using. Reassignment throttles reduce production impact. Cruise Control or equivalent tooling can generate safer movement plans. Leader balancing can spread request load without moving every byte. More granular partitioning can make movement chunks smaller, although too many partitions introduce controller, metadata, and recovery costs.

Those mitigations improve the workflow, but they do not change the unit of work. The cluster is still moving data because the data lives on brokers.

The Architecture Change: Data Is Not Bound to the Broker

AutoMQ approaches the problem by separating storage from compute. Brokers remain Kafka-compatible at the protocol layer, but durable log data is offloaded through S3Stream to object storage, with a WAL layer absorbing writes before data is flushed to object storage. AutoMQ's stateless broker documentation describes this as storage-compute separation: broker nodes do not own the persistent partition data in the same way a traditional Kafka broker does.

When broker compute no longer owns durable log segments, partition reassignment changes shape. A reassigned partition does not need to drag its full retained history from one broker's disk to another broker's disk. The assignment can move at the metadata layer, and the receiving broker can serve the partition against shared durable storage. The operation still needs coordination, fencing, leadership changes, cache warming, and health checks, but it is no longer proportional to retained data size.

Metadata-level reassignment in AutoMQ

That is why metadata-level reassignment is such a large operational shift. A traditional reassignment asks, "How fast can I copy the partition?" A stateless broker reassignment asks, "How fast can the cluster safely transfer ownership?" Those questions lead to different runbooks.

AutoMQ's partition reassignment documentation states that shared storage allows reassignment to sync a small amount of data rather than moving the full partition log. A public Grab story gives a production reference point: after moving toward AutoMQ's shared storage architecture, Grab reported reducing full-cluster partition reassignment from up to 6 hours in the previous setup to less than a minute. Treat that as a workload-specific proof point, not a universal SLA for every cluster and every deployment shape.

What Still Needs Engineering Judgment

Metadata-level reassignment does not remove the need for engineering discipline. It moves the hard part away from bulk data copying and toward safe ownership transfer. Platform teams still need to observe leader distribution, request load, consumer lag, cache behavior, WAL health, object storage health, and controller stability, but these checks are no longer wrapped around a huge data migration.

The evaluation question should be concrete. If your current kafka partition reassignment workflow is painful, measure the parts separately:

  • Data volume moved per operation. This tells you how much of the delay is structural rather than procedural.
  • Safe migration bandwidth. This shows the capacity you can spend on reassignment without hurting production.
  • Catch-up time after copy. This reveals whether ongoing write traffic is extending the reassignment window.
  • Leader movement impact. This separates storage movement from request-load movement.
  • Operational frequency. A rare annual rebalance is annoying; a weekly scaling or maintenance event becomes a platform tax.

Once you have those numbers, the trade-off becomes clearer. If reassignment delay is mostly data-copy time, better scripts help at the margins, but the architectural ceiling remains. If the delay is mostly planning, throttling policy, or uneven partition design, improving the traditional Kafka workflow may be enough.

How to Think About the Fix

There are three levels of response to slow Kafka broker scaling. The first is operational hygiene: generate smaller reassignment batches, throttle intentionally, monitor ISR and under-replicated partitions, and avoid mixing risky maintenance with heavy traffic periods. This reduces incident probability without a platform migration.

The second is automation. Tools can continuously detect imbalance, propose movement plans, and keep brokers from drifting too far apart. Automation works well when the cost of each movement is acceptable, but it becomes less attractive when every correction carries a large data-copy bill.

The third is architecture. Stateless broker design changes the relationship between compute and data, which changes broker scaling economics. AutoMQ is one implementation of that model: Kafka-compatible brokers, shared object storage, WAL-backed writes, and metadata-level partition reassignment. For large-scale Kafka teams, the argument is that scaling and maintenance stop being data migration events by default.

The opening incident had a familiar shape: a team added brokers to reduce risk, then spent hours managing the risk created by moving data onto them. That loop is what happens when compute scaling is tied to broker-local storage. Break that tie, and kafka partition rebalance stops being a storage migration. It becomes what teams expected in the first place: a fast ownership change with controlled traffic shift.

Sources and Further Reading

Newsletter

Subscribe for the latest on cloud-native streaming data infrastructure, product launches, technical insights, and efficiency optimizations from the AutoMQ team.

Join developers worldwide who leverage AutoMQ's Apache 2.0 licensed platform to simplify streaming data infra. No spam, just actionable content.

I'm not a robot
reCAPTCHA

Never submit confidential or sensitive data (API keys, passwords, credit card numbers, or personal identification information) through this form.