Troubleshooting

Kafka Consumer Rebalancing: Causes and Fixes

Every rebalance pauses some or all of a consumer group. A few a day are normal; a rebalance every few minutes means lag, duplicates and angry downstream teams. Here is how to find the trigger and stop the storm.

Published November 20, 2026 · 6 min read · KLogic Team

A rebalance is how a consumer group redistributes partitions when its membership or subscription changes. With the classic "eager" protocol every member stops consuming, gives up all its partitions and waits for a new assignment. Even with modern incremental protocols, partitions that move stop being processed until their new owner picks them up. That is why frequent rebalancing shows up as stalled throughput and lag that grows in sawtooth spikes.

What triggers a rebalance

Only a few events start a rebalance, and almost every storm comes from the first two:

  • A member is considered dead. It stopped heartbeating for longer than session.timeout.ms (45 seconds by default since Kafka 3.0), usually because the process crashed, the pod was killed or the network blipped.
  • A member left because it was too slow. If the time between two poll() calls exceeds max.poll.interval.ms (5 minutes by default), the client proactively leaves the group. This is the classic cause: a batch of records takes longer to process than the poll interval allows.
  • A member joined or left on purpose: scaling up or down, a rolling deployment, a restart.
  • The subscription changed: new partitions were added to a subscribed topic, or a regex subscription now matches a new topic.

Prove the cause with consumer metrics

Guessing is expensive. The Java consumer exposes coordinator and fetch metrics that make the cause obvious. These live under kafka.consumer:type=consumer-coordinator-metrics and consumer-metrics:

MetricWhat a bad value means
rebalance-rate-per-hourThe headline number. More than a handful per hour outside deployments is a problem.
rebalance-latency-avg / maxHow long each rebalance takes. Long rebalances multiply the cost of every trigger.
failed-rebalance-rate-per-hourRebalances that had to be retried, often members joining and leaving at the same time.
time-between-poll-maxIf this approaches max.poll.interval.ms, processing time is your trigger.
last-poll-seconds-agoA consumer that has not polled for a long time is stuck in processing or blocked.

On the broker side, the group coordinator logs every member that joins, leaves or times out, with a reason. When the log says a member left because the poll interval was exceeded, you have your answer.

Fix 1: make processing fit inside the poll interval

If time-between-poll-max is close to the limit, you have three levers:

  • Fetch less per poll. Lower max.poll.records (default 500) so each batch finishes sooner.
  • Allow more time. Raise max.poll.interval.ms to comfortably exceed your worst batch. This only delays detection of genuinely stuck consumers, so do not set it to hours.
  • Make processing faster or asynchronous. Slow downstream calls (databases, HTTP APIs) are the usual culprit. Batch them, add timeouts, or hand records to a worker pool and pause the partition while it drains.

Fix 2: static membership for restarts and deployments

With static membership (KIP-345), each consumer instance declares a stable identity. When it restarts within the session timeout, the coordinator gives it the same partitions back without a rebalance.

group.instance.id=orders-consumer-${POD_NAME}   # stable per instance
session.timeout.ms=60000                          # long enough to cover a restart

On Kubernetes, use the StatefulSet pod name or another identity that survives restarts. Rolling deployments then stop triggering a rebalance per pod.

Fix 3: incremental rebalancing

The CooperativeStickyAssignor (KIP-429) replaces "stop the world" with incremental rebalancing: only partitions that actually need to move are revoked, and everyone else keeps consuming.

partition.assignment.strategy=org.apache.kafka.clients.consumer.CooperativeStickyAssignor

Switching an existing group from an eager assignor needs two rolling restarts: first add the cooperative assignor alongside the old one, then remove the old one.

Fix 4: the new consumer group protocol (KIP-848)

Kafka 4.0 made the new consumer rebalance protocol generally available. Assignment moves to the broker-side group coordinator, rebalances are incremental by design, and a slow member no longer blocks the rest of the group. Clients opt in with:

group.protocol=consumer

It needs brokers and clients that support it, so treat it as an upgrade project rather than a config flip. Our Kafka 4.0 guide covers what changes for monitoring.

Don't forget the fast-failing consumer

Sometimes rebalancing is a symptom of a crash loop: a consumer hits a bad record, throws, restarts, rejoins and crashes again. The group rebalances every minute and lag grows on one partition only. The fix is not a timeout, it is handling poison messages, usually with a dead letter queue.

A worked example: the five-minute batch

An (illustrative) order-processing group of six consumers starts rebalancing every few minutes after a release. Lag on the input topic grows in a sawtooth: it climbs during each rebalance, partly recovers, then climbs again. Nothing is crashing, and the pods report healthy.

The consumer metrics tell the story quickly. rebalance-rate-per-hour jumped from about 1 to over 15, and time-between-poll-max sits at almost exactly 300 seconds, the default max.poll.interval.ms. The broker's group coordinator logs confirm it: members are leaving because the poll interval was exceeded.

The release had added a call to a pricing service for every order. With the default max.poll.records=500, a batch now takes 500 sequential HTTP calls. On a slow afternoon each call takes a few hundred milliseconds, the batch takes more than five minutes, the consumer is kicked out, its partitions move, and the new owner hits the same problem.

The team applies three changes in order of speed:

  1. Lower max.poll.records to 100 as an immediate mitigation, which brings batches back under the limit.
  2. Batch the pricing lookups so one call handles many orders.
  3. Add static membership so the next rolling deployment does not trigger six rebalances.

Rebalances return to deployments only, and lag stays flat. The general lesson: when time-between-poll-max approaches the poll interval, the fix is in your processing code, not in Kafka. Watching lag per partition, as in our consumer lag guide, makes these patterns visible early.

What good looks like

  • Rebalances only during deployments and scaling events, and each one finishes in seconds.
  • time-between-poll-max comfortably below the poll interval, even at peak.
  • Lag that rises briefly during a deployment and recovers within a minute or two.

KLogic tracks each group's state and rebalance events alongside its lag, and WatchDog flags groups that start rebalancing more than usual. Ask the AI assistant why a group is lagging and it can pull that rebalance history into the answer.

Rebalancing in Kafka Streams and Kafka Connect

Kafka Streams applications and Kafka Connect workers both use group membership under the hood, so they rebalance too, with some extra machinery.

Kafka Streams

A Streams application is a consumer group whose members also own local state stores. Moving a task means moving its state, which can take minutes for large stores. Since Kafka 2.6, Streams uses warm-up replicas and probing rebalances: a task stays where it is until a new owner has restored its state, then moves. Two settings matter most:

  • num.standby.replicas keeps a hot copy of each store on another instance, so failover does not wait for a full restore.
  • max.warmup.replicas and probing.rebalance.interval.ms control how quickly tasks are moved to balance load after scaling.

Watch restore progress and task assignment changes when Streams applications scale. Our Kafka Streams monitoring guide lists the relevant metrics.

Kafka Connect

Connect workers form a group that distributes connectors and tasks. Since Kafka 2.3 Connect uses incremental cooperative rebalancing: when a worker leaves, its tasks are not reassigned immediately but after scheduled.rebalance.max.delay.ms (5 minutes by default), giving a restarting worker time to come back. If a worker is gone for good, its tasks resume elsewhere after that delay, which shows up as a gap in that connector's throughput. See Connect monitoring for task-level health.

Common questions

How many rebalances per hour is normal?

Outside deployments and scaling, a healthy group often goes hours without one. A few per hour usually signals a problem; dozens per hour is a rebalance storm.

Does increasing session.timeout.ms stop rebalances?

Only those caused by missed heartbeats, such as brief network blips or restarts. It does nothing for members that exceed max.poll.interval.ms, and it slows detection of crashed consumers.

Is cooperative rebalancing always better?

For most groups, yes: unaffected partitions keep flowing during a rebalance. Groups that rely on revoking every partition at once, for example to flush shared state, need code changes first. The KIP-848 protocol in Kafka 4.0 is incremental by design.

Why does lag grow on only one partition?

Usually one slow or failing record (a poison message) or one hot key. Check the consumer logs for repeated failures on that partition and consider a dead letter queue.

Can I see rebalances without client metrics?

Yes. The broker tracks group state, and admin tools report when a group is in PreparingRebalance or CompletingRebalance. KLogic consumer group monitoring records these state changes alongside lag.

See your Kafka clusters the way KLogic does

Consumer lag, replication health, alerts and AI-assisted debugging in one place, for self-hosted Kafka, AWS MSK and Confluent.

Free 14-day trial · No credit card required