Skip to content

[Core] Fix internal LB load-balancing - #49204

Merged
njhill merged 5 commits into
vllm-project:mainfrom
njhill:fix-internal-dp-lb
Jul 27, 2026
Merged

njhill merged 5 commits into
vllm-project:mainfrom
njhill:fix-internal-dp-lb

Conversation

@njhill

@njhill njhill commented Jul 20, 2026

Copy link
Copy Markdown
Member

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_counts in the EngineCoreProc superclass). 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.

@njhill
njhill requested a review from BugenZhao as a code owner July 20, 2026 13:33

@claude claude Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Claude Code Review

This pull request is from a fork — automated review is disabled. A repository maintainer can comment @claude review to run a one-time review.

@mergify

This comment was marked as resolved.

1 similar comment
@mergify

This comment was marked as resolved.

@mergify

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
njhill force-pushed the fix-internal-dp-lb branch from 9aeede5 to 5cc6249 Compare July 20, 2026 14:43
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)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Looks like we missed this extra scoring in Rust?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

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.

@njhill
njhill enabled auto-merge (squash) July 22, 2026 09:59
@njhill
njhill merged commit 59a6b04 into vllm-project:main Jul 27, 2026
100 checks passed
@njhill
njhill deleted the fix-internal-dp-lb branch July 27, 2026 14:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ready ONLY add when PR is ready to merge/full CI is needed rust v1

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: DP request distribution becomes imbalanced under long-context workload on H20 GPU

2 participants