[Core] Fix internal LB load-balancing - #49204
Merged
Merged
Conversation
njhill
force-pushed
the
fix-internal-dp-lb
branch
from
July 20, 2026 13:34
e92843e to
c62b26a
Compare
This was referenced Jul 20, 2026
Closed
This comment was marked as resolved.
This comment was marked as resolved.
1 similar comment
This comment was marked as resolved.
This comment was marked as resolved.
njhill
force-pushed
the
fix-internal-dp-lb
branch
from
July 20, 2026 14:04
c62b26a to
9aeede5
Compare
njhill
requested review from
ApostaC,
WoosukKwon,
alexm-redhat,
heheda12345,
ivanium,
orozery,
robertgshaw2-redhat and
ywang96
as code owners
July 20, 2026 14:04
This comment was marked as resolved.
This comment was marked as resolved.
Co-authored-by: Debasish Mohanty <139056705+debasish-87@users.noreply.github.com> Signed-off-by: Nick Hill <nickhill123@gmail.com>
njhill
force-pushed
the
fix-internal-dp-lb
branch
from
July 20, 2026 14:43
9aeede5 to
5cc6249
Compare
BugenZhao
reviewed
Jul 21, 2026
Comment on lines
+1444
to
+1451
| if waiting: | ||
| # Waiting requests are penalized in proportion to KV cache | ||
| # pressure: a queue on a KV-bound engine drains slowly, so | ||
| # new requests should strongly prefer other engines. With | ||
| # low KV usage the queue is transient (e.g. mid-burst) and | ||
| # the penalty stays off, preserving exact round-robin. | ||
| # Ramps from 0 at <=50% usage to 3x waiting at 100%. | ||
| score += waiting * 6.0 * max(0.0, kv_cache_usage - 0.5) |
Member
There was a problem hiding this comment.
Looks like we missed this extra scoring in Rust?
Member
Author
There was a problem hiding this comment.
Actually I found that it wasn't needed on the rust side. Across the different workloads tested, rust's balancing based just on inflight requests worked out just as good.
BugenZhao
approved these changes
Jul 22, 2026
njhill
enabled auto-merge (squash)
July 22, 2026 09:59
4 tasks
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.
Previous PR #30739 added support for efficient DP without EP. The coordinator was kept to propagate engine queue stats for loadbalancing, but there was an omission whereby these stats were not actually getting published, which could result in significant imbalance between the ranks.
As well as fixing this (by also calling
_maybe_publish_request_countsin theEngineCoreProcsuperclass). I also ran more tests and experiments to refine the internal LB balancing logic across various scenarios in general for both python and rust frontends. In particular, on the python side the kv cache usage is now taken into account when weighting the waiting vs running queue counts.Fixes #48808.
Claude was used to help.