feat: introduce processing rate to max ratio as poll-idle-ratio replacement#19622
Open
Fly-Style wants to merge 3 commits into
Open
feat: introduce processing rate to max ratio as poll-idle-ratio replacement#19622Fly-Style wants to merge 3 commits into
Fly-Style wants to merge 3 commits into
Conversation
FrankChen021
left a comment
Member
There was a problem hiding this comment.
| Severity | Findings |
|---|---|
| P0 | 0 |
| P1 | 0 |
| P2 | 1 |
| P3 | 0 |
| Total | 1 |
| Severity | Findings |
|---|---|
| P0 | 0 |
| P1 | 0 |
| P2 | 1 |
| P3 | 0 |
| Total | 1 |
Reviewed 8 of 8 changed files.
This is an automated review by Codex GPT-5.5
|
|
||
| final int lowInitialTaskCount = 1; | ||
| // This ensures tasks are busy processing (low idle ratio) | ||
| Executors.newSingleThreadExecutor().submit(() -> { |
Member
There was a problem hiding this comment.
[P2] Shut down the background publisher executor
The new test creates a single-thread ExecutorService and immediately drops it. That executor uses a non-daemon worker and is never shut down, so the embedded-test JVM can stay alive after the test returns; on timeout or failure it can also keep publishing into the topic while cleanup is running. Keep a reference and shut it down/cancel the Future in a finally block or use an existing managed executor.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Kafka's
poll-idle-ratiois not the best possible metric to represent the idle cost for autoscaler - it reflects time spent polling, not whether the task has spare processing capacity. Also, it is not supported for Kinesis, which is still in play in read-world productions.This patch adds an alternative idle signal :
1 - (avgProcessingRate / maxObservedRate), gated behind a new opt-in flaguseUtilizationRatio(default false, so existing deployments are unaffected).CostBasedAutoScaler: tracks a bounded watermark of the task's best-observed processing rate (maxObservedRate), feeding CostMetrics.WeightedCostFunction: when the flag is on, derives idle ratio from that utilization ratio instead ofpollIdleRatio; falls back toIDEAL_IDLE_RATIOuntil a watermark sample exists (cold start).CostBasedAutoScalerConfig: new useUtilizationRatio boolean, wired through builder/serde/equals/hashCode.CostMetrics: new nullable maxObservedRate field; old constructor kept (delegates with null) since three test call sites still use it.This PR has: