suzhiking opened a new pull request, #24196: URL: https://github.com/apache/kafka/pull/24196
On a stable streams group, every heartbeat of every member derives the intermediate assignment afresh to find out whether a refinement step is due, although the refiner's inputs rarely change between two steps. This PR reuses the intermediate assignment cached for the epoch until one of them does. Each commit can be reviewed on its own: 1. `StreamsGroup` counts the changes to the refiner's inputs: the members (including their current assignments as they reconcile), the target assignment, the configured topology, the task offsets and the heartbeat versions. The cached intermediate assignment is kept with that count and with `num.warmup.replicas` and `acceptable.recovery.lag`, which change without a new epoch. A stable heartbeat reuses it when the epoch and all of these match. The count is a plain field rather than a timeline container, because task offsets and heartbeat versions are not rolled back on a failed write either. 2. `AssignmentRefiner.isAffectedByTaskOffsetsChange` lets the refiner say which task offset reports can change what it derives. `AssignmentRefinerImpl` counts a report only if, for some task, it changes whether an offset is reported, whether anything has been restored, or whether the task is caught up. This is stacked on #23969: its 13 commits come first, and only the last two are new here. `StreamsGroupHeartbeatBenchmark` from #24101, stable group, 1,000 members, 5,000 stateful tasks, one standby, MIXED lag, budget 2, µs per heartbeat (mean of two runs): | Migrating | #23969 | This PR | |---|---|---| | 0% | 227 | 26 | | 1% | 1,259 | 26 | | 50% | 2,920 | 26 | | 100% | 4,252 | 40 | The benchmark's heartbeats carry no task offsets, so each measured heartbeat reuses the cached intermediate assignment. A heartbeat that changes an input of the refiner still derives it, at the cost of #23969. -- 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]
