Skip to content

[Router] Add phase 1 router queue groundwork - #905

Open
ardecode wants to merge 1 commit into
vllm-project:mainfrom
ardecode:router-side-queue-phase1-infra
Open

ardecode wants to merge 1 commit into
vllm-project:mainfrom
ardecode:router-side-queue-phase1-infra

Conversation

@ardecode

@ardecode ardecode commented Apr 7, 2026 •

Copy link
Copy Markdown
Contributor

Refs #855

Summary

This PR adds the Phase 1 groundwork for router-side request queueing.

It does not yet enable router-side request queueing in the request path. Instead, it lands the supporting pieces needed for follow-up PRs:

  • router queue CLI/config validation
  • round-robin admissible endpoint selection helper
  • fast admission-oriented engine stats refresh support
  • app initialization plumbing for the admission scrape path

What is included

  • add router queue config flags and validation
  • add round-robin helper for selecting the next admissible endpoint
  • extend engine stats scraping with an admission-oriented fast refresh interval
  • add parser tests for the new validation

What is not included yet

  • no admission controller
  • no request queueing in route_general_request
  • no lease lifecycle or first-token release
  • no router queue metrics

Testing

  • uv run --group lint pre-commit run --all-files
  • uv run --group test pytest src/tests/test_parser.py -q

@gemini-code-assist gemini-code-assist Bot 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.

Code Review

This pull request introduces router-side request queuing for round-robin routing, including new CLI configuration options, validation logic, and a dual-interval metrics scraping mechanism. Feedback identifies critical thread-safety concerns in both the EngineStatsScraper and RoundRobinRouter singletons. Additionally, there are concerns regarding O(N^2) performance overhead during metrics updates and the potential for premature timeouts when using a single minimum timeout value for both full and admission-only scrapes.

Comment thread src/vllm_router/stats/engine_stats.py Resolved
Comment thread src/vllm_router/stats/engine_stats.py Resolved
@ardecode

Copy link
Copy Markdown
Contributor Author

@ruizhang0101 , ready for review!

@ruizhang0101

Copy link
Copy Markdown
Collaborator

@aeon-x Could you take a look at this?

Comment thread src/vllm_router/parsers/parser.py Resolved
@aeon-x

aeon-x commented Apr 21, 2026

Copy link
Copy Markdown
Collaborator

For getting num_requests_waiting from vllm, have you found any other solutions than scraping the full /metrics every admission interval?

I am concerned that this design might not be scalable when we have to scrape many endpoints.

Adds the supporting pieces for router-side request queueing, without
enabling queueing in the request path:

- router queue CLI flags and validation
- round-robin admissible endpoint selection helper
- admission-oriented fast refresh interval for engine stats scraping
- app initialization plumbing for the admission scrape path

Signed-off-by: ardecode <[email protected]>
@ardecode
ardecode force-pushed the router-side-queue-phase1-infra branch from cd871a3 to 8296ea2 Compare July 25, 2026 04:53
@ardecode

Copy link
Copy Markdown
Contributor Author

For getting num_requests_waiting from vllm, have you found any other solutions than scraping the full /metrics every admission interval?

I am concerned that this design might not be scalable when we have to scrape many endpoints.

Thanks for the review @aeon-x, and sorry for the slow turnaround. All four of your inline comments are addressed.

On scraping the full /metrics every admission interval, you are right. The scrape is sequential and blocking, so a round costs N × (RTT + parse). Two fixes: pooled + concurrent transport, and a targeted parse instead of the full Prometheus parse.

On /load it exists and returns {"server_load": N}, but its behind --enable-server-load-tracking (default False) and counts in-flight requests at the API server, not num_requests_waiting.

Happy to land the two fixes here, or split them out ahead of the admission controller.

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

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants