consumer-4 fails, partition 4 stops receiving messages, potentially blocking critical data streams, such as payment transactions.
A stalled partition in a payment system can cause transaction delays or data inconsistencies. Ensure you configure rebalancing parameters appropriately.
How Consumer Rebalancing Works
When a consumer joins or leaves the group, Kafka triggers a rebalance:- Consumption Pause
All active consumers halt message processing. - Partition Reassignment
Kafka redistributes partitions to achieve an even workload. - Resuming Consumption
Consumers resume processing with their new assignments.

Eager vs. Cooperative Rebalancing Protocols
Kafka offers two protocols for partition reallocation:| Protocol | Behavior | Use Case |
|---|---|---|
| Eager | Revokes and reassigns all partitions at once. | Simple logic, but longer processing pause. |
| Cooperative | Incrementally revokes/assigns partitions for minimal downtime. | Low-latency environments. |
Rebalance Triggers and Group Membership
Rebalancing occurs upon:- Consumer Failure: Unexpected crashes or network partitions.
- Consumer Join: Scaling out with new instances.
- Consumer Shutdown: Graceful or forced termination.
Kafka’s consumer rebalancing guarantees at-least-once delivery, preventing data loss or duplication during assignments.

Best Practices
- Adjust
session.timeout.msandheartbeat.interval.msfor faster failure detection. - Prefer the cooperative protocol for latency-sensitive applications.
- Monitor consumer lag with tools like Kafka Monitor or Confluent Control Center.