Engineering Note
Kafka 4.0 Consumer Rebalance: Coordination Moves to the Broker
Apache Kafka 4.0 made the new rebalance protocol generally available. This post explains what changes from the old protocol, why broker-side assignment matters, and what it means operationally.
When operating Kafka consumer groups, rebalance events are hard to ignore.
When consumers join or leave, topic partitions change, or session timeouts occur, the group redistributes partition ownership. Some consumers revoke partitions, receive new assignments, and resume polling.
The problem is that this is not just an implementation detail. It is visible in operations.
Long rebalances increase processing delay.
Unstable consumers make lag jump in steps.
Large groups make synchronization cost more visible.
In Apache Kafka 4.0, KIP-848, The Next Generation of the Consumer Rebalance Protocol, became generally available. The Kafka documentation describes it as the new consumer rebalance protocol. In this post, I will call it the new rebalance protocol.
The core idea is short:
The center of rebalance coordination moves from the consumer client to the broker group coordinator.
This is more than a configuration rename. It is a structural change intended to scale consumer groups better, reduce rebalance time, and simplify consumer clients.
Who Coordinated Rebalance in the Old Protocol?
I will call the previous consumer group protocol the old protocol. I will use classic only when referring directly to Kafka configuration values or official documentation terminology.
Simplified, the old protocol works like this:
1. Consumers send JoinGroup requests to the group coordinator.
2. The coordinator selects a group leader consumer.
3. The leader consumer computes assignment from group members and topic metadata.
4. Members receive assignments through SyncGroup.
5. Consumers revoke and assign partitions, then resume processing.
The important detail is that the broker does not directly compute partition assignment. The broker group coordinator manages membership, but the assignment strategy lives on the consumer client side, and the selected group leader computes the assignment.
This worked well for a long time. But as groups grow, consumers multiply, and subscriptions become more complex, a few costs become visible.
- Rebalance can behave like a global synchronization barrier.
- The leader consumer owns assignment computation.
- Clients need compatible assignors and protocol metadata.
- Members that do not need much change may still wait for the group.
- Assignment policy is tightly coupled to client rollout.
Cooperative rebalancing improved this significantly. CooperativeStickyAssignor is much better operationally than eager revocation of all partitions. But the broad shape of the old protocol remains: client-side assignment and group-level synchronization.
Kafka 4.0’s new rebalance protocol changes that deeper structure.
What Changes in the New Rebalance Protocol?
In the new rebalance protocol, the group coordinator takes more responsibility.
The biggest change is that assignment moves server-side.
old protocol:
client leader computes assignment
new rebalance protocol:
broker group coordinator computes and coordinates assignment
Consumers no longer list client-side assignors through partition.assignment.strategy. In the new rebalance protocol, the broker-side group.consumer.assignors configuration defines available server-side assignors. The built-in defaults are uniform and range.
On the consumer side, group.remote.assignor can optionally select a server-side assignor by name. If it is not set, the first assignor in the broker’s group.consumer.assignors list is used.
From a configuration perspective:
# consumer client
group.protocol=consumer
# optional: choose a server-side assignor by name
group.remote.assignor=uniform
On the broker side:
# broker
group.consumer.assignors=uniform,range
group.consumer.heartbeat.interval.ms=5000
group.consumer.session.timeout.ms=45000
The official consumer config documentation says group.protocol supports classic and consumer, and the new rebalance protocol is used when consumer is specified. The default is still classic.
So having Kafka 4.0 brokers does not automatically move every group to the new rebalance protocol.
server: the new protocol is available starting with Kafka 4.0
client: group.protocol=consumer must be set explicitly
Heartbeat and Timeout Move to the Broker Too
In the old protocol, consumer clients own values such as heartbeat.interval.ms and session.timeout.ms.
In the new rebalance protocol, these client settings are no longer used.
Kafka documentation lists these configurations and APIs as no longer usable when group.protocol=consumer is enabled:
heartbeat.interval.ms
session.timeout.ms
partition.assignment.strategy
enforceRebalance()
enforceRebalance(String)
Heartbeat interval and session timeout move to broker configuration:
group.consumer.heartbeat.interval.ms
group.consumer.session.timeout.ms
This is not a small change.
In the old protocol, different consumer applications could carry different heartbeat and session timeout settings. In the new rebalance protocol, the coordinator gives members the heartbeat interval and manages failure detection more consistently from the broker side.
Operationally, some values that used to be “consumer application config” become closer to “cluster policy.”
Incremental Design Reduces the Global Barrier
The Kafka documentation says the new protocol has a fully incremental design and no longer relies on a global synchronization barrier, reducing rebalance times.
That sentence is the heart of the change.
In old-protocol rebalances, the group often feels like it has to gather, synchronize, and receive a new assignment together. When one member joins or leaves, the whole group can wait for the new assignment flow.
In the new rebalance protocol, the coordinator manages target assignment and members reconcile only the changes they need.
Conceptually:
old protocol:
everyone pauses, rejoins, and receives a new assignment
new rebalance protocol:
the coordinator owns target assignment,
and members incrementally follow necessary partition changes
The real implementation is more involved, but the operational point is simple:
rebalance should shake less of the whole group.
That is the main meaning of the Kafka 4.0 new rebalance protocol.
Why This Matters
First, it matters for large consumer groups.
The more consumers and partitions a group has, the more visible coordination cost becomes. A rebalance lasting only a few seconds can still create processing delay, lag spikes, and downstream delay.
The new rebalance protocol lets the group coordinator manage assignment and propagate changes incrementally, which should scale better for larger groups.
Second, it simplifies clients.
In the old protocol, clients need to understand assignors, subscription metadata, leader-side assignment computation, and cooperative versus eager behavior. The new rebalance protocol moves part of that responsibility to the broker.
This direction is especially important for the multi-language Kafka client ecosystem. Moving core rebalance and assignment logic server-side can reduce client-to-client differences over time.
Third, it centralizes operational policy.
Assignor lists, heartbeat interval, and session timeout move to broker-side configuration. Consumer group behavior becomes more of a cluster-level operating policy.
Fourth, rebalance can become more observable.
Kafka documentation notes that new consumer metrics were added when the new rebalance protocol is used, mainly to provide visibility into the improved threading model. When the protocol is organized around the group coordinator, rebalance becomes a more explicit operational object.
It Does Not Solve Everything
The new rebalance protocol is important, but it is not universal magic.
Kafka documentation lists these limitations:
Client-side assignors are not supported.
Rack-aware assignment strategies are not fully supported.
So if your environment depends heavily on custom client-side assignors, migration may not be immediate. The new protocol expects the server-side assignor model.
If you depend strongly on rack-aware assignment, check the current support status before moving critical groups.
Regex subscription also needs attention. With the new rebalance protocol, subscribe(SubscriptionPattern) evaluates regular expressions on the server side and uses RE2J format. If a consumer relies on Java regex details, this should be verified.
How to Think About Upgrade
Kafka documentation describes both offline and online upgrade paths.
The offline path is straightforward:
stop all consumers in the group
restart them with group.protocol=consumer
the empty group converts between the old and new protocol
The downside is that the consumer group must be down.
Online upgrade is also possible. Rolling out consumers with group.protocol=consumer converts the group from the old protocol to the new protocol when the first new-protocol consumer joins. However, the documentation says this is only possible when the old-protocol group uses an assignor that does not embed custom metadata.
A safe operational sequence looks like this:
1. Confirm brokers are Kafka 4.0 or later.
2. Review broker group.consumer.* settings.
3. Check the current consumer assignor.
4. Check whether custom client-side assignors are used.
5. Check whether regex subscriptions are used.
6. Test group.protocol=consumer on a small group.
7. Watch lag, rebalance metrics, and assignment changes.
8. Expand to important groups later.
This is not merely a one-line config migration. It changes the ownership model of rebalance.
Old and New Protocol Side by Side
The differences can be summarized like this:
| Area | old protocol | new protocol (group.protocol=consumer) |
|---|---|---|
| Enablement | group.protocol=classic or default | group.protocol=consumer |
| Assignment computation | group leader consumer | broker group coordinator |
| Assignor config | partition.assignment.strategy | broker group.consumer.assignors, client group.remote.assignor |
| Heartbeat interval | client heartbeat.interval.ms | broker group.consumer.heartbeat.interval.ms |
| Session timeout | client session.timeout.ms | broker group.consumer.session.timeout.ms |
| Rebalance shape | stronger global barrier | fully incremental design |
| Client-side assignor | supported | not supported |
| Familiarity | mature and familiar | GA since Kafka 4.0, explicit enablement required |
The old protocol has not disappeared. Kafka documentation says it can still be used to form consumer groups.
So the new rebalance protocol is not “change everything immediately.” It is a new choice for workloads where rebalance behavior matters.
What Operators Should Watch
When adopting the new rebalance protocol, lag alone is not enough.
Useful signals include:
- rebalance frequency
- rebalance duration
- assignment change frequency
- number of revoked and assigned partitions
- consumer lag changes
- poll latency
- processing latency
- coordinator request latency
- heartbeat-related metrics
- consumer thread metrics
- broker group coordinator load
The important question is not only “did rebalances become fewer?” It is “did rebalances disturb processing less?”
Watch whether lag spikes are smaller, whether only affected members move partitions, whether unaffected members keep processing, and whether rolling deploys become smoother.
A tool like Konduo is useful when observing this kind of change because consumer rebalance is not just one client setting. It is an operational behavior shaped by the broker coordinator, consumer processing, partition assignment, and host resource conditions together.
The Meaning: Broker-Side Control Plane for Rebalance
Kafka 4.0’s new rebalance protocol can be summarized this way:
consumer group rebalance moves from client-leader negotiation
to a broker-coordinator-centered incremental control plane.
That is a direction for operating consumer groups at larger scale.
The old protocol is still valid. For small groups, familiar assignors, and stable existing operations, there may be no urgent need to migrate.
But if consumer groups are large, rolling deploys create lag spikes, and rebalance time is an operational issue, Kafka 4.0’s new rebalance protocol is worth evaluating.
The core idea is this:
rebalance is not just a consumer-internal event.
it is an operational control plane.
Kafka 4.0 pulls that control plane more strongly into the broker.
Further Reading
For related Kafka coordination and operations topics, these posts connect well with this one:
- Not Every Consumer Group Consumes: How Kafka Nodes Find Each Other - Explains Kafka group coordination beyond ordinary message consumption.
- Consumer Lag Is Not a Health Score: Thinking in Kafka Consuming Pressure - Reframes lag after rebalance as part of broader processing pressure.
- Can Kafka Client Metrics Fill the Observability Gap? - Looks at why consumer-side observability signals matter.