0
0
Kafkadevops~10 mins

Cooperative vs eager rebalancing in Kafka - Visual Side-by-Side Comparison

Choose your learning style9 modes available
Process Flow - Cooperative vs eager rebalancing
Consumer Group Start
Assign Partitions
Detect Group Change?
NoContinue Processing
Yes
Rebalancing Triggered
Eager Rebalancing
Revoke All Partitions
Reassign All Partitions
Resume Processing
Wait for Next Group Change
When a consumer group changes, Kafka triggers rebalancing. Eager rebalancing revokes and reassigns all partitions at once, pausing processing fully. Cooperative rebalancing revokes and assigns partitions incrementally, allowing smoother transitions.
Execution Sample
Kafka
1. Consumer group detects member leave
2. Eager: revoke all partitions immediately
3. Eager: assign all partitions to new members
4. Cooperative: revoke only partitions needed
5. Cooperative: assign partitions incrementally
6. Consumers resume processing
This sequence shows how eager rebalancing revokes all partitions at once, while cooperative rebalancing does it step-by-step.
Process Table
StepEventEager Rebalancing ActionCooperative Rebalancing ActionProcessing Status
1Member leaves groupTrigger full rebalanceTrigger incremental rebalanceProcessing paused (both)
2Revoke partitionsRevoke all partitions immediatelyRevoke only partitions neededEager: paused fully, Cooperative: partial pause
3Assign partitionsAssign all partitions to new membersAssign partitions incrementallyEager: no processing, Cooperative: partial processing
4Resume processingResume after full rebalanceResume as partitions assignedEager: resumes later, Cooperative: resumes sooner
5Wait for next changeIdle until next rebalanceIdle until next rebalanceProcessing ongoing
💡 Rebalancing ends when all partitions are assigned and consumers resume processing
Status Tracker
VariableStartAfter Step 2After Step 3After Step 4Final
Partitions Assigned (Eager)All assignedNone assigned (revoked all)All assignedAll assignedAll assigned
Partitions Assigned (Cooperative)All assignedSome revokedSome assignedAll assignedAll assigned
Processing Status (Eager)RunningPaused fullyPaused fullyRunningRunning
Processing Status (Cooperative)RunningPartially pausedPartially runningRunningRunning
Key Moments - 3 Insights
Why does eager rebalancing pause all processing at once?
Because eager rebalancing revokes all partitions immediately (see execution_table step 2), consumers cannot process any data until reassignment finishes.
How does cooperative rebalancing allow some processing during rebalance?
Cooperative rebalancing revokes only needed partitions incrementally (execution_table step 2), so consumers keep processing partitions not revoked yet.
What triggers rebalancing in both modes?
Any group membership change like a consumer leaving or joining triggers rebalancing (execution_table step 1).
Visual Quiz - 3 Questions
Test your understanding
Look at the execution_table at step 2, what happens in eager rebalancing?
ANo partitions are revoked
BOnly some partitions are revoked
CAll partitions are revoked immediately
DPartitions are assigned incrementally
💡 Hint
Check the 'Eager Rebalancing Action' column at step 2 in execution_table
According to variable_tracker, after step 3, what is the processing status in cooperative rebalancing?
APartially running
BPaused fully
CRunning fully
DStopped
💡 Hint
Look at 'Processing Status (Cooperative)' after step 3 in variable_tracker
If a new consumer joins, which step in execution_table shows the rebalance trigger?
AStep 5
BStep 1
CStep 3
DStep 4
💡 Hint
Rebalancing triggers on group membership changes shown in step 1
Concept Snapshot
Cooperative vs eager rebalancing in Kafka:
- Eager revokes all partitions at once, pausing processing fully
- Cooperative revokes partitions incrementally, allowing partial processing
- Rebalancing triggers on group membership changes
- Cooperative reduces downtime and improves stability
- Eager is simpler but causes full pause during rebalance
Full Transcript
In Kafka consumer groups, rebalancing happens when group membership changes. Eager rebalancing revokes all partitions immediately, causing all consumers to pause processing until reassignment completes. Cooperative rebalancing revokes partitions incrementally, allowing consumers to keep processing partitions not yet revoked. This reduces downtime and improves stability. The execution table shows step-by-step actions for both modes, and the variable tracker shows how partition assignments and processing status change over time. Key moments clarify why eager pauses fully and cooperative allows partial processing. The visual quiz tests understanding of these steps and states.