dajac opened a new pull request, #24220:
URL: https://github.com/apache/kafka/pull/24220
When every member of a cohort with the lowest number of extra
partitions already has an extra partition of the topic,
`AssignRemainingExtraPartitions.nextMember` scanned the whole cohort
twice for every remaining extra partition of the topic: once for the
round robin, which finds nobody, and once for the first member without
one having the fewest extra partitions. After members leave or topics
gain partitions in a large homogeneous group, this makes the step
quadratic in the size of the cohort.
This patch remembers, until the next topic, that the round robin finds
nobody, and serves the members without an extra partition of the topic
having the fewest extra partitions from a cursor in member order. The
cursor moves back to the first member only when that number changes,
so the cohort is scanned twice per such number instead of twice per
extra partition. The assignment does not change.
Where it helps: homogeneous groups of 500 members or more after a tenth
of the members leave (`LEAVE_MANY`), when the topics have many
partitions. It does not help the other events, heterogeneous groups or
groups of 50 members or fewer.
`ConsumerAssignorBenchmark` ran all its 2,016 shapes without racks,
with and without this patch. Eight shapes are at least 10% faster, all
of them homogeneous `LEAVE_MANY` shapes. Times per assignment, from
the fastest fork:
- 5,000 members, 5 topics, 10,000 partitions, `EQUAL`: 3.64 ms to
0.86 ms.
- 5,000 members, 5 topics, 20,000 partitions, `EQUAL`: 3.90 ms to
1.39 ms.
- 5,000 members, 500 topics, 20,000 partitions, `SKEWED`: 3.98 ms to
1.34 ms.
- 500 members, 50 topics, 20,000 partitions, `EQUAL`: 1.57 ms to
0.92 ms.
- 500 members, 500 topics, 20,000 partitions, `SKEWED`: 1.00 ms to
0.88 ms.
- 500 members, 50 topics, 10,000 partitions, `SKEWED`: 0.46 ms to
0.39 ms.
- 500 members, 50 topics, 5,000 partitions, `SKEWED`: 0.30 ms to
0.26 ms.
- 500 members, 500 topics, 5,000 partitions, `EQUAL`: 0.28 ms to
0.25 ms.
The other 19 homogeneous `LEAVE_MANY` shapes of 500 and 5,000 members
are between 0.91 and 1.12 of the time without the patch, and so are the
ones of 5 and 50 members. Over all 2,016 shapes the geometric mean of
the ratio is 1.00 and the allocation per assignment does not change.
Nine shapes are more than 10% slower, four homogeneous and five
heterogeneous, all under 2 ms.
--
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]