feat(router): pluggable load-balancing strategies + live dashboard sw…#7
Merged
Conversation
…itch Make request routing a swappable policy instead of a hard-coded least-load selector. Adds a strategy registry with 7 strategies — least_load (default, unchanged behaviour), round_robin, random, least_inflight, p2c, and session_affinity / prefix_affinity (sticky routing with a load escape valve for multi-turn chat & shared-prompt cache reuse). Router: - routing_strategies.py: SelectContext + registry + score_instance (extracted from the old selector, so least_load is byte-for-byte identical); failover, in-flight accounting, and per-backend cooldown stay in the proxy and apply to every strategy. - backend_selector.select_instance_least_load kept as a thin wrapper (compat). - Strategy chosen per-group (model_config.routing_strategy) > global env (LLMOPS_ROUTING_STRATEGY) > default; session/prefix keys extracted in the proxy. - GET/POST /routing to read + hot-swap the global strategy (no reload), exposed via nginx; dashboard Traffic page gets a selector + a per-strategy help card. Frontend: - routing strategy is a first-class field in the add/edit dialog and the detail drawer, kept out of the raw vLLM-param list (shared routingStrategies.ts). Fixes: - launchers: never pass router-only keys (routing_strategy) to `vllm serve`, which errored on the unknown argument. - AddModelDialog: a null lora_modules from the config no longer leaks into the param list and gets re-submitted as "" (failed list validation). Tests: router unit suite (strategies + /routing endpoint) and a launcher regression; frontend type-check clean. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
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.
…itch
Make request routing a swappable policy instead of a hard-coded least-load selector. Adds a strategy registry with 7 strategies — least_load (default, unchanged behaviour), round_robin, random, least_inflight, p2c, and session_affinity / prefix_affinity (sticky routing with a load escape valve for multi-turn chat & shared-prompt cache reuse).
Router:
Frontend:
Fixes:
vllm serve, which errored on the unknown argument.Tests: router unit suite (strategies + /routing endpoint) and a launcher regression; frontend type-check clean.