dajac opened a new pull request, #24153: URL: https://github.com/apache/kafka/pull/24153
`ConsumerGroup` and `StreamsGroup` check every member on each member update, member removal and epoch change (and topology change for streams) to decide whether the group is `RECONCILING` or `STABLE`. Updating the members of a group one at a time, for instance when loading a group or converting a classic group, makes this O(N^2) for a group of N members. This patch keeps the number of stable members at each member epoch in a `TimelineHashMap`, which `updateMember` and `removeMember` adjust for the old and the new member. The group is reconciling when the count at the target assignment epoch is below the number of members, so the counts do not depend on the assignment epoch and stay valid in any replay order. Median time per operation for a stable consumer group of N members subscribed to 5 topics of 16 partitions, before -> after (JMH). Load replays the group records, conversion is `ConsumerGroup#fromClassicGroup`, and heartbeat moves one member between `STABLE` and `UNREVOKED_PARTITIONS`. | N | Load | Conversion | Heartbeat | |------|-------------------|-------------------|--------------------| | 10 | 33 us -> 32 us | 19 us -> 19 us | 1.3 us -> 1.2 us | | 100 | 143 us -> 106 us | 107 us -> 63 us | 0.87 us -> 0.47 us | | 1000 | 4.3 ms -> 0.98 ms | 4.2 ms -> 0.45 ms | 3.8 us -> 0.47 us | | 4000 | 58 ms -> 5.3 ms | 54 ms -> 2.1 ms | 12.5 us -> 0.55 us | -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
