feat(concurrency-detector): Add hybrid mode to concurrency detector#1991
Conversation
"hybrid" mode is a new concurrency detector mode that has been added which takes into account both concurrency based on token and request. Its saturation is computed as: `saturation = max(requestSaturation, tokenSaturation)` Using just request based concurrency is not enough as different workloads such as prefill heavy tends to consume more GPU compute, using just the tokenSaturation suffers from wrong estimation of output tokens which falls down in low ISL and high OSL workloads. Hybrid concurrency detector attempts to solve this problem by essentially capping whichever saturates first due to high ISL/OSL workload. Signed-off-by: mohammadkhan <mohammadkhan@digitalocean.com>
There was a problem hiding this comment.
Pull request overview
This PR extends the concurrency saturation detector plugin used by the EPP flow-control layer to support a new hybrid mode that combines request-based and token-based load signals, so backpressure and endpoint filtering trigger as soon as either resource dimension becomes constraining.
Changes:
- Added
hybridas a supportedconcurrencyMode, with validation and docs updates. - Updated pool saturation computation to report
max(requestSaturation, tokenSaturation)in hybrid mode. - Updated endpoint filtering logic to drop endpoints in hybrid mode when either the request or token safety limit is reached, and added targeted unit tests.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| pkg/epp/framework/plugins/flowcontrol/saturationdetector/concurrency/README.md | Documents the new hybrid mode behavior and its saturation/filter semantics. |
| pkg/epp/framework/plugins/flowcontrol/saturationdetector/concurrency/detector.go | Implements hybrid-mode saturation aggregation and hybrid endpoint admission logic. |
| pkg/epp/framework/plugins/flowcontrol/saturationdetector/concurrency/detector_test.go | Adds factory validation and behavior tests for hybrid saturation and filtering. |
| pkg/epp/framework/plugins/flowcontrol/saturationdetector/concurrency/config.go | Adds modeHybrid and allows it through configuration validation. |
|
/assign @LukeAVanDrie |
LukeAVanDrie
left a comment
There was a problem hiding this comment.
Nice work! Once the linting issue is fixed, this LGTM.
Signed-off-by: mohammadkhan <mohammadkhan@digitalocean.com>
Pool saturation is defined as average of saturation across each endpoint, this is exactly how it is computed but in multi-dimensional saturation cases such as hybrid, this wasn't true. This fixes it. Signed-off-by: mohammadkhan <mohammadkhan@digitalocean.com>
| // - "requests": use discrete request counts for capacity accounting. | ||
| // - "tokens": use estimated token counts for capacity accounting. | ||
| // - "hybrid": evaluate both request and token accounting and report whichever | ||
| // reaches saturation first (the more constraining of the two). |
There was a problem hiding this comment.
Non-blocking: this wording (and the modeHybrid const comment below) still describes the aggregate-max semantics. Someone reading only the config schema could expect the pool to report 1.0 as soon as either dimension saturates anywhere. Suggest mentioning the per-endpoint average:
// - "hybrid": evaluate each endpoint as the more constraining of its request and
// token ratios; pool saturation is the average of these across endpoints.
LukeAVanDrie
left a comment
There was a problem hiding this comment.
Approved with nit
Thanks @asharkhan3101!
Signed-off-by: mohammadkhan <mohammadkhan@digitalocean.com>
What type of PR is this?
/kind feature
What this PR does / why we need it:
Request based concurrency detector is not enough as prefill heavy workloads tends to consume more GPU compute and saturate. In this case token based detector works but it falls short when OSL heavy workload arrives as it suffer from output token estimation problem. In such cases "request" based concurrency fits well since it puts an upper limit on number of requests that can be dispatched to endpoints. So we need something in between that works well in both ends.
Hybrid concurrency detector attempts to solve this problem by essentially capping whichever saturates first.
Its saturation is computed as average saturation of all endpoints, where each endpoint saturation is calculated as:
saturation = max(requestSaturation, tokenSaturation)Which issue(s) this PR fixes:
Fixes #1990
Release note (write
NONEif no user-facing change):