Skip to content

feat(concurrency-detector): Add hybrid mode to concurrency detector#1991

Merged
LukeAVanDrie merged 11 commits into
llm-d:mainfrom
asharkhan3101:ashar/hybrid-concurrency-detector
Jul 23, 2026
Merged

feat(concurrency-detector): Add hybrid mode to concurrency detector#1991
LukeAVanDrie merged 11 commits into
llm-d:mainfrom
asharkhan3101:ashar/hybrid-concurrency-detector

Conversation

@asharkhan3101

@asharkhan3101 asharkhan3101 commented Jul 13, 2026

Copy link
Copy Markdown
Contributor

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 NONE if no user-facing change):

concurrency-detector(hybrid): new concurrency mode has been added which takes into account both concurrency based on token and request for saturation.

"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>
Copilot AI review requested due to automatic review settings July 13, 2026 17:49
@asharkhan3101
asharkhan3101 requested review from a team and shmuelk as code owners July 13, 2026 17:49
@asharkhan3101
asharkhan3101 requested review from elevran and vMaroon July 13, 2026 17:49
@github-actions github-actions Bot added kind/bug Categorizes issue or PR as related to a bug. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. kind/cleanup kind/documentation Categorizes issue or PR as related to documentation. kind/feature Categorizes issue or PR as related to a new feature. labels Jul 13, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 hybrid as a supported concurrencyMode, 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.

Comment thread pkg/epp/framework/plugins/flowcontrol/saturationdetector/concurrency/detector.go Outdated
@ahg-g

ahg-g commented Jul 16, 2026

Copy link
Copy Markdown
Collaborator

/assign @LukeAVanDrie

@ahg-g ahg-g added this to the v0.10 llm-d v0.9.0 release milestone Jul 16, 2026
LukeAVanDrie
LukeAVanDrie previously approved these changes Jul 17, 2026

@LukeAVanDrie LukeAVanDrie left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice work! Once the linting issue is fixed, this LGTM.

Signed-off-by: mohammadkhan <mohammadkhan@digitalocean.com>
asharkhan3101 and others added 4 commits July 17, 2026 14:30
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).

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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
LukeAVanDrie previously approved these changes Jul 22, 2026

@LukeAVanDrie LukeAVanDrie left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approved with nit

Thanks @asharkhan3101!

@github-actions github-actions Bot removed kind/feature Categorizes issue or PR as related to a new feature. kind/bug Categorizes issue or PR as related to a bug. kind/documentation Categorizes issue or PR as related to documentation. labels Jul 23, 2026
@github-actions github-actions Bot added kind/bug Categorizes issue or PR as related to a bug. kind/cleanup kind/documentation Categorizes issue or PR as related to documentation. kind/feature Categorizes issue or PR as related to a new feature. and removed kind/cleanup labels Jul 23, 2026
Signed-off-by: mohammadkhan <mohammadkhan@digitalocean.com>

@LukeAVanDrie LukeAVanDrie left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

kind/bug Categorizes issue or PR as related to a bug. kind/cleanup kind/documentation Categorizes issue or PR as related to documentation. kind/feature Categorizes issue or PR as related to a new feature. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add hybrid mode of concurrency detector that uses both token and requests

5 participants