Skip to content

feat(vllm_model): assign a new session to the endpoint with the fewest calls in flight - #7326

Draft
coreyhu wants to merge 1 commit into
NVIDIA-NeMo:mainfrom
coreyhu:feat/session-assignment-by-load
Draft

coreyhu wants to merge 1 commit into
NVIDIA-NeMo:mainfrom
coreyhu:feat/session-assignment-by-load

Conversation

@coreyhu

@coreyhu coreyhu commented Dec 6, 2026 •

Copy link
Copy Markdown

What does this PR do?

With several base_url endpoints, vllm_model picks a session's endpoint by a hash of the session key. That evens out how many sessions each endpoint is given over a run, not how many it serves at once. Sessions last for different times, so one endpoint can serve several times the sessions of another for hours.

session_assignment: fewest_calls_in_flight gives a new session to the endpoint with the fewest engine calls in flight; the hash picks among endpoints that tie. The session keeps that endpoint for all its calls, as before. The default, hash, is unchanged.

  • With route_around_failing_endpoints: a failed endpoint takes a new session only as its trial call, and a session moved off a failed endpoint returns to the endpoint it was first given.
  • One worker process only: the counts live in one process, so more than one worker is refused at start-up.

No issue is linked. I can open one first if you would rather discuss the setting there.

Validation

  • pytest responses_api_models/vllm_model/tests/test_app.py: 799 passed (790 on main, 9 new).
  • The two tests of the setting with route_around_failing_endpoints fail when that handling is removed.
  • ruff check and ruff format --check on the changed files.

Rollouts

N/A: no environment or agent code changes. The evidence for the rule is a replay of a recorded 60-hour training run (two engines, 96 rollouts in flight, 4,388 rollouts): open rollouts per engine differed by 13.3 on average and 45 at worst with the hash, and by 1.8 and 12 with this rule.

Compatibility and benchmark impact

None by default: the setting is opt-in. With it on, which endpoint serves a session depends on load, so the server prints each session's endpoint.

Checklist

  • I have read the contributing guidelines.
  • The change is focused; unrelated "drive-by" edits are tracked as separate issues/PRs.
  • Tests added or updated and pass locally, or N/A for docs-only / non-code changes (so CI unit/server checks pass when applicable).
  • Documentation added or updated, or N/A with justification.
  • Pre-commit checks pass locally (pre-commit run --all-files) (so CI lint/format checks pass).
  • New source files include the required Apache-2.0 SPDX header.
  • All commits have DCO sign-off (git commit -s) (so the DCO check passes).

…t calls in flight

With several base_url endpoints, vllm_model picks a session's endpoint by
a hash of the session key. That evens out how many sessions each endpoint
is given over a run, not how many it serves at once: sessions last for
different times, so one endpoint can serve several times the sessions of
another for hours. In a 60-hour training run with two engines and 96
rollouts in flight, the engines' open rollouts differed by 13 on average
and by 45 at worst.

session_assignment: fewest_calls_in_flight gives a new session to the
endpoint with the fewest engine calls in flight; the hash picks among
endpoints that tie. The session keeps that endpoint for all its calls, as
before. The server prints each session's endpoint, which can no longer be
computed from the key. The default, hash, is unchanged.

With route_around_failing_endpoints, a failed endpoint takes a new session
only as its trial call, and a session moved off a failed endpoint returns
to the endpoint it was first given once that serves again, as it returns
to its hashed endpoint today.

The counts are one process's, so the setting is refused with more than one
worker.

Signed-off-by: Corey Hu <corey.hu@scale.com>
@copy-pr-bot

copy-pr-bot Bot commented Dec 6, 2026

Copy link
Copy Markdown

This pull request requires additional validation before any workflows can run on NVIDIA's runners.

Pull request vetters can view their responsibilities here.

Contributors can view more details about this message here.

@nemo-autobot nemo-autobot Bot added the community-request Issue reported or requested by someone from the community label Dec 6, 2026
@svcnvidia-nemo-ci svcnvidia-nemo-ci added risk:mid Autobot PR risk: mid feature New capabilities, enhancements, or enablement work area:model Model servers, inference providers, and model adapters labels Dec 6, 2026

This branch has not been deployed

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

Labels

area:model Model servers, inference providers, and model adapters community-request Issue reported or requested by someone from the community feature New capabilities, enhancements, or enablement work risk:mid Autobot PR risk: mid

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants