Compare commits

...
Author SHA1 Message Date
JannikStandGitHub 58f4b37d5b Add router_url support for elastic inference pool (#2049)
Release / Push CUDA image to Docker (push) Canceled after 0s
* Add router_url support for elastic inference pool

When configured, inference requests route through a vllm-router
while admin operations (weight updates, LoRA loading) still go
directly to discovered pods via elastic DNS discovery.

* Gate router traffic on ready servers

Only expose the router client when there are actually ready backends,
preventing requests from being sent to a router with no healthy pods
during weight updates or scale-down.
2026-03-20 02:11:39 +01:00
2 changed files with 19 additions and 1 deletions
+7
View File
@@ -196,6 +196,13 @@ class ClientConfig(BaseConfig):
),
] = None
router_url: Annotated[
str | None,
Field(
description="URL of a vllm-router for load-aware inference routing. When set with elastic mode, inference requests go through the router while admin operations (weight updates, LoRA loading) still go directly to discovered pods.",
),
] = None
@property
def is_elastic(self) -> bool:
"""Check if elastic mode is enabled."""
+12 -1
View File
@@ -108,6 +108,7 @@ class ElasticInferencePool:
port: int = 8000,
sync_interval: float = 5.0,
client_type: str = "openai_chat_completions",
router_url: str | None = None,
):
self.logger = get_logger()
self.hostname = hostname
@@ -117,6 +118,7 @@ class ElasticInferencePool:
self.port = port
self.sync_interval = sync_interval
self.client_type = client_type
self.router_url = router_url
self._servers: dict[str, ServerState] = {}
self._admin_clients: dict[str, AsyncClient] = {}
@@ -143,6 +145,7 @@ class ElasticInferencePool:
port=config.elastic.port,
sync_interval=config.elastic.sync_interval,
client_type=client_type,
router_url=config.router_url,
)
await pool.start()
return pool
@@ -162,7 +165,15 @@ class ElasticInferencePool:
@property
def clients(self) -> list[vf.ClientConfig]:
urls = self.ready_urls
# When a router URL is configured, route inference requests through it
# instead of directly to discovered pods. Admin operations still use
# individual pod IPs via admin_clients.
# Only expose the router when backends are actually ready — otherwise
# the orchestrator would send requests into a router with no healthy backends.
if self.router_url and self.ready_urls:
urls = [self.router_url]
else:
urls = self.ready_urls
if set(urls) != set(self._client_urls):
self._client_urls = urls
self._client_index = 0