Apache Kafka Streaming (50 Qs)•Part 2: Core Architecture & Implementation (Mid-Level)
What is the Consumer Rebalance Protocol (Eager vs. Incremental Cooperative Rebalancing)?
senior LevelSystem Design
In Simple Words:
- Eager Rebalancing (Legacy):
- When any consumer joins or leaves, all consumers in the group stop processing, revoke all their partition assignments, and rejoin the group.
- Causes "stop-the-world" latency spikes across entire consumer fleets for seconds or minutes.
- Cooperative Sticky Rebalance (Modern Default):
- Instead of revoking all partitions, consumers continue processing partitions that do not need to move.
- Only the specific partitions being migrated to another consumer are revoked in a 2-phase non-blocking protocol.
- Processing continues uninterrupted for unaffected partitions.