Consumer Group Coordination & Partition Assignors
Understand how the Group Coordinator manages cluster membership, traces the JoinGroup and SyncGroup protocol, and compare Range, RoundRobin, and Sticky assignors.
When four instances of a service join the same consumer group to read a 12-partition topic, who decides which consumer reads which partition? How does the cluster detect when an instance crashes, and how are partitions reassigned without human intervention?
Kafka delegates this coordination to a designated broker called the Group Coordinator and uses client-side Partition Assignors to distribute partitions fairly.
In this lesson, you will trace the inner workings of the consumer group rebalance protocol, understand the group state machine, and evaluate the built-in partition assignment strategies.
01The Group Coordinator: Who is in Charge?
Every consumer group has exactly one broker designated as its Group Coordinator.
How does Kafka choose which broker coordinates your group?
- Kafka computes the hash of your group name:
hash(group.id) % 50(assuming 50 partitions in__consumer_offsets). - If
hash("order-fulfillment") % 50yields partition24, Kafka looks up which broker is currently the partition leader of__consumer_offsets-24. - That broker becomes the Group Coordinator for your consumer group.
When any consumer instance in the group boots up, it issues a FindCoordinator request to any broker in bootstrap.servers. The broker responds with the network address of the coordinator broker, and the consumer connects directly to it.
Loading the rest of the lesson…