suzhiking opened a new pull request, #24367:
URL: https://github.com/apache/kafka/pull/24367

   `AssignmentRefinerImpl.refine()` runs on every heartbeat of a stable streams 
group. This PR makes a call cheaper without changing the intermediate 
assignment it derives. It is the first part of #23969 and has two commits, each 
one optimization:
   
   1. Return the target assignment right after the case analysis when it stages 
no migration. Warm-up tasks and withheld standbys only follow from a staged 
migration, and a granted task needs no patch, so the remaining passes would 
patch nothing.
   2. Walk every task fewer times:
      - Each process's load is counted in the walk that indexes the current 
assignment. It used to take a second walk over every member's tasks, which 
created a task ID for every task only to count it.
      - The standby placements that borrowed migrations hold back are found by 
looking up the target standby holders of the borrowed tasks, where every target 
standby used to be walked.
      - That lookup is built when it is first read, because building it walks 
every member's target standbys and a refinement may not need it.
   
   Besides the unit tests, the refiner was checked against trunk's on 20,000 
random groups, including groups that keep their active tasks and groups with a 
member not heard from, with identical results.
   
   `AssignmentRefinerBenchmark.refinerImpl`, 1,000 members, 5,000 stateful 
tasks, one standby, MIXED lag, budget 2, µs per call:
   
   | Migrating | Before | After |
   |---|---|---|
   | 0% | 4,658 | 2,654 |
   | 1% | 5,188 | 3,328 |
   | 50% | 6,962 | 5,404 |
   | 100% | 8,432 | 6,404 |
   


-- 
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]

Reply via email to