Quick revision
The short answer
With eager rebalancing, every member gives up all its partitions and rejoins, so one consumer restarting pauses the whole group of ten, twice: once when it leaves and once when it returns. With cooperative incremental rebalancing (CooperativeStickyAssignor), members keep the partitions that do not move and only the moving ones are revoked, in a follow-up rebalance, so the other nine keep consuming. With static membership (group.instance.id), a member that comes back within session.timeout.ms simply gets its partitions back with no rebalance at all, though its partitions are not consumed while it is away.
What to remember
In this answer, we compared three ways to handle one restart in a group of ten. Eager rebalancing revokes everything and pauses all members twice. Cooperative incremental rebalancing keeps partitions that do not move and transfers the rest in a follow-up rebalance, so most consumption continues. Static membership with group.instance.id avoids the rebalance entirely when the member returns within session.timeout.ms, at the price of its partitions waiting while it is away. Groups default to eager through the [RangeAssignor, CooperativeStickyAssignor] list, switching needs two rolling restarts, and Spring Kafka sets everything through consumer properties.
Your turn
Answer it aloud as you would in the interview, or type your answer below. Then show one part at a time and compare.
With eager rebalancing, every member gives up all its partitions and rejoins, so one consumer restarting pauses the whole group of ten, twice: once when it leaves and once when it returns. With cooperative incremental rebalancing (CooperativeStickyAssignor), members keep the partitions that do not move and only the moving ones are revoked, in a follow-up rebalance, so the other nine keep consuming. With static membership (group.instance.id), a member that comes back within session.timeout.ms simply gets its partitions back with no rebalance at all, though its partitions are not consumed while it is away.
Why this question is asked
Rebalances are where consumer groups spend their worst moments: lag spikes during deploys, duplicate processing, and dashboards full of 'group is rebalancing'. Interviewers ask this comparison because the three mechanisms solve different parts of the problem and are often combined. In this answer, we will recap what a rebalance does in the classic protocol, then follow one restart out of ten through eager, cooperative and static membership, see the defaults and how to switch a live group safely, and show how to set it all in Spring Kafka.
1A Quick Recap of a Classic Rebalance
In the classic consumer group protocol, a rebalance is a round of two requests. Every member sends JoinGroup to the group coordinator, a broker; one member, the leader, receives the full membership list and computes the assignment with the configured assignor; then everyone sends SyncGroup and receives its partitions. A rebalance starts whenever membership changes: a consumer joins, leaves, or misses its session timeout.
The question is what members do with their current partitions during that round. That is the difference between eager and cooperative.
2Eager Rebalancing: Stop the World
In the eager protocol, used by RangeAssignor, RoundRobinAssignor and StickyAssignor, every member revokes all of its partitions before joining, commits its offsets, and consumes nothing until the new assignment arrives. The reasoning is simple and safe: nobody can hold a partition that is about to move, because nobody holds anything.
Now restart one consumer out of ten. When it shuts down, it leaves the group: rebalance one, and all ten stop. Its partitions are spread over the other nine. When it starts again, it joins: rebalance two, all ten stop again, and partitions are spread back. Each stop lasts as long as the slowest member takes to reach its next poll(), which can be seconds or more. One restart, two group-wide pauses.
3Cooperative Incremental Rebalancing: Move Only What Must Move
Cooperative incremental rebalancing, which CooperativeStickyAssignor uses, changes the rule: members keep their partitions while joining. The leader computes the new assignment while trying to keep partitions where they are (that is the 'sticky' part). Any member that owns a partition that must move gives up just that partition, and a second, follow-up rebalance hands the freed partitions to their new owners. Partitions that stay put are never interrupted.
With one restart out of ten, when the member leaves, its partitions are unowned, so they go straight to the others while all nine keep consuming what they had. When it returns, the leader decides which partitions to give it; their current owners revoke only those, and the follow-up rebalance assigns them. At any moment only a handful of partitions are paused.
7 messages in order. Play them, or step through them one at a time.
Only the partitions that move ever stop; the rest of the group never pauses.
4Static Membership: Avoid the Rebalance Altogether
Static membership attacks a different question: should a quick restart cause a rebalance at all? By default, a member's identity is a generated member id that is new on every start, so the coordinator cannot tell that the restarted process is the same one. If we set group.instance.id to a stable name, such as the pod name, the member becomes static. A static member does not send a leave request when it shuts down, and when it rejoins with the same instance id within session.timeout.ms, the coordinator hands back its previous assignment without rebalancing anyone.
The cost is visible in the same example: while the restarted member is down, nobody consumes its partitions, so their lag grows for the restart's duration. If it never comes back, its partitions stay idle until the session timeout expires, and only then does a normal rebalance move them. So static membership is ideal for short, planned restarts with a session timeout sized just above the restart time.
| Mechanism | Rebalances | Who stops consuming |
|---|---|---|
Eager (RangeAssignor) | 2, group-wide | All ten members, twice |
Cooperative (CooperativeStickyAssignor) | 2 to 4 small ones | Only partitions that move |
| Static membership | 0 if back within the session timeout | Only the restarting member's partitions |
| Static + cooperative | 0 normally; small ones if it does not return | Restarting member's partitions only |
5Defaults and Switching a Live Group
The Java client's default partition.assignment.strategy is the list [RangeAssignor, CooperativeStickyAssignor]. All members must agree on a protocol, and the group uses the first one in that list that everyone supports, so a default group stays eager with RangeAssignor. Listing the cooperative assignor second is there to make migration possible.
Switching a running group needs two rolling restarts, because eager and cooperative members cannot be mixed blindly. First, roll every member to a list that contains both, with the cooperative assignor available on all members; the group still runs eagerly while old members remain. Second, roll again with only CooperativeStickyAssignor; once every member supports only cooperative, the group switches. Doing it in one roll risks a moment where a member using eager logic and one using cooperative logic disagree about who owns what.
6Setting It in Spring Kafka
Spring Boot passes any consumer property through spring.kafka.consumer.properties, so both settings are one line each. The instance id must be unique per running member and stable across restarts, which in Kubernetes usually means a StatefulSet pod name exposed through an environment variable.
Notice one Spring detail: with concurrency greater than 1, a container creates several consumers in the same process, and each needs its own instance id. Spring Kafka appends a suffix per child consumer when group.instance.id is set, but check your version's behaviour before relying on it.
7Follow-up questions
Does cooperative rebalancing make rebalances faster?
Not necessarily shorter; it can even take two rounds instead of one. What it changes is the impact: during those rounds, members keep consuming everything except the few partitions that move, so the group's throughput hardly dips.
What about the new consumer group protocol?
With group.protocol=consumer, available since Kafka 4.0, the broker computes assignments and members reconcile incrementally on their own, so there is no group-wide barrier at all, and partition.assignment.strategy no longer applies. Static membership with group.instance.id still exists there.
8Conclusion
In this answer, we compared three ways to handle one restart in a group of ten. Eager rebalancing revokes everything and pauses all members twice. Cooperative incremental rebalancing keeps partitions that do not move and transfers the rest in a follow-up rebalance, so most consumption continues. Static membership with group.instance.id avoids the rebalance entirely when the member returns within session.timeout.ms, at the price of its partitions waiting while it is away. Groups default to eager through the [RangeAssignor, CooperativeStickyAssignor] list, switching needs two rolling restarts, and Spring Kafka sets everything through consumer properties.
Open with
In the classic protocol, a rebalance is a JoinGroup and SyncGroup round where the leader member computes the assignment. With eager rebalancing, which RangeAssignor uses, every member revokes all its partitions before joining, so nothing is consumed until the new assignment arrives.
Then, if they want more
One restart out of ten causes two group-wide pauses: one when it leaves and one when it comes back. With cooperative incremental rebalancing, CooperativeStickyAssignor, members keep their partitions while rejoining, the assignor tries to keep partitions where they are, and only the partitions that must move are revoked and handed over in a follow-up rebalance.
So the other nine keep consuming throughout. Static membership is different again: if I set group.instance.id to a stable name like the pod name, the member does not send a leave on shutdown, and if it rejoins within session.timeout.ms it gets its old partitions back with no rebalance at all.
The trade-off is that its partitions are not consumed while it is down. The Java default assignor list is RangeAssignor then CooperativeStickyAssignor, so groups stay eager until you switch, and switching a live group takes two rolling restarts. In Spring Boot I set both through spring.kafka.consumer.properties, and I usually combine static membership with cooperative assignment.
About this answer
- Last updated
- 13 November 2026
- Versions it names
- Kafka 4.0
- 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 "Compare eager rebalancing, cooperative incremental rebalancing...": https://scrivio-interview-library.netlify.app/spring-boot/kafka-clients-in-depth/8fcb16de0a/