The purpose of this post is to explain about Kafka consumer rebalancing and how static membership help to avoid consumer rebalancing. To get an idea about kafka partitions assignment for consumers, please refer this blog post.
Key Points
- Single consumer rebalancing will effect on whole group, so it will stop message processing in whole consumer group.
- On consumer rebalancing, KafkaRebalanceListener#onPartitioned() method will be called just before it take away it's partitions.
Examples: 1. Consumer requesting leave group.
2. Already existed consumers partitions move to newly joined consumer.
- Both consumer leave and join cause for consumer rebalance.
- When you use static membership , coordinator will aware about that group_instance_id property since it will send to coordinator with request at join group process.
- With static membership, consumer doesn't send Leave Group Request in a failure or restart. Because of that broker coordinator will wait till it reach session.timeout.ms . If the consumer came back within that time period, there won't be any rebalancing.