This is a lightweight fork of vllm-project/production-stack with the following changes:
- Multi-stage Docker build: Builder stage installs dependencies with uv, runtime stage is just
python:3.13-slimwith the venv copied over. The default image omits PyTorch, sentence-transformers, and vLLM. Proposed upstream as a slim image variant in issue #1238. - Python 3.13: Both builder and runtime stages use Python 3.13.
- Single-label hostname fix:
validate_urlregex accepts Docker/K8s hostnames without dots (e.g.,http://vllm-worker:8000). Upstream fix pending in PR #1154, which supersedes the closed #737. - Qwen rerank template: Preprocesses
/v1/rerankrequests forQwen/Qwen3-Reranker-0.6Bwith the required chat template before forwarding to the backend. Malformed or non-object JSON uses upstream's shared 400 response contract. - Default port 8080: Changed from 8001 to match the vllm-project/router default for easier future migration.
- Model alias discovery:
/v1/modelslists static aliases alongside canonical model names so clients can discover the names they may request. The per-requestRouting request …log line ends withrequested_model=(the name the client sent),model=(after alias resolution),stream=andmax_tokens=(max_completion_tokenswhen set;Nonewhen the client set no limit). Proposed upstream in issue #1237. - Request lifecycle and backend timeouts: Each attempt records completion, failure, or client cancellation exactly once. Connect and read-silence bounds return structured 502/504 errors, including an in-band terminal event for stalled SSE streams. See Request-stats lifecycle. Upstream: the aborted latency status is PR #1234; the timeout findings are on PR #1082.
- Early client disconnects abort the engine request: While it waits for backend response headers, the router watches the client the way vLLM's
@with_cancellationdoes. vLLM sends a non-streaming response's headers only when generation finishes, so a client that gave up on a non-streaming request used to leave the engine generating until completion or--backend-read-timeout. The router now closes the upstream request at once and the engine aborts it. The attempt retires as an abort and logsClient disconnected before headerswith its request ID and elapsed time. Disconnects after headers, including streams, behave as before. This covers the JSON routes such as chat, completions and embeddings;/v1/rerank(which replays a rewritten body), multipart audio and image routes, and disaggregated prefill do not watch the client before headers. Upstream: we support the earlier equivalent PR #1040 for issue #634 and closed our duplicate #1233. - Multipart compatibility: Includes upstream audio translation routing, text/SRT/VTT responses, and automatic transcription language detection. Priority and prefix routing also work with multipart requests. HTML backend error pages and malformed backend JSON still return 502, with the fork's lifecycle cleanup preserved.
- Backend DNS recovery: Backend and external-provider hostnames are resolved with the system resolver (
getaddrinfo) instead of aiohttp's c-ares default, whichaiohttp[speedups]enables. c-ares kept its own cache of failed lookups inside the router for up to an hour, so a backend Service or container created after the router first tried it kept returning 502backend_connect_erroruntil that entry expired or the router restarted. The router now asks the system resolver again on the next request. Negative caching in CoreDNS, systemd-resolved, or another upstream resolver still applies, and aiohttp still caches successful lookups for 10 s. This covers the proxy client, disaggregated-prefill sessions, sleep/wake calls, and OpenAI-compatible external providers; running routers need the new image to pick it up. The shared-client change is pending in upstream PR #1162. See Backend DNS resolution. - Dynamic-config file accepts all fork flags: The
--dynamic-config-yaml/--dynamic-config-jsonwatcher used to reject any key that was not a hot-reloadable field, raisingTypeErrorevery 10 s and silently killing hot-reload of service discovery / routing. The fork's startup-only flags — the backend socket timeouts — therefore could not live in the config file you already pass, even though they load fine at startup. The watcher now tolerates non-reconfigurable keys: they are honored at startup and ignored (debug-logged) on reload, so you can keep all configuration in one file. See Loading fork flags from the dynamic config file below. Pending upstream in PR #1235.
The checkout includes upstream vllm-stack-0.1.14 at 405a2fa. Upstream now
provides POST /pooling, the uvicorn keep-alive flag, per-dispatch identity,
and Python 3.13-compatible NumPy. Ordinary streams are forwarded without
retaining the full body. A configured response callback receives the complete
body for requests dispatched while it is active. The fork also preserves live
discovery reload for static backends that omit model types.
The published router image is available for linux/amd64 and linux/arm64. See the 0.1.14 release record for the verified digest.
docker pull openimage/production-stack-router:v0.1.14The release workflow applies the reconciled fork changes, including merge resolutions, onto an upstream release tag and runs the router regression suite before publishing versioned images. It requires HTTP 200 from the image's /health before promoting latest.
For development, start with AGENTS.md and the fork maintenance guide, which records the release workflow and decisions shared by coding tools.
The stock vllm/vllm-openai image ships without the audio extras, so POST /v1/audio/transcriptions fails at request time with ImportError: Please install vllm[audio] for audio support (surfaced to clients as a generic 400 Invalid or unsupported audio file). A drop-in replacement installs the vLLM audio extra (av, soundfile, soxr, scipy, … — the set tracks the vLLM version), pinned to the exact vLLM build in the base image so nothing else changes:
docker pull openimage/vllm-openai-audio:v0.25.1This image now lives in the vLLM engine fork,
Mazyod/vllm. Everything about the vLLM engine was consolidated there; production-stack owns only the router. The fork layers the audio extra and a small series of upstream bugfix backports onto a pinnedvllm/vllm-openairelease — see itsFORK.md. The image name, registry, and drop-in entrypoint are unchanged, soopenimage/vllm-openai-audiostays the pull target and swapping the image keeps Whisper/transcription endpoints working.
RequestStatsMonitor tracks in-flight requests as per-engine counters split by stage: on_new_request increments in_prefill_requests, the first response token moves the count to in_decoding_requests, and completion retires it. At the original fork baseline, the completion hook sat outside a finally, so terminal paths other than a clean return skipped it. Upstream 0.1.14 includes stage-aware cleanup and a unique ID per dispatch. The fork also tracks the terminal outcome of each attempt, locks concurrent statistics reads, and bounds backend silence.
The counters are per-engine aggregates rather than per-request, so adding a finally alone is not sufficient and is actively harmful: retiring a request that never reached decoding decrements in_decoding_requests anyway, stealing the decrement owed to a different concurrent request while the aborted request's prefill count leaks regardless. The fork therefore preserves stage-aware finalization alongside the upstream cleanup fix.
The monitor now issues an opaque handle per backend attempt. The external X-Request-Id is caller-controlled and two concurrent requests may share one, so it is retained as metadata only and never used as identity. Each attempt has one authoritative active record naming the stage it is in; the finalizer pops that record first and retires the attempt from its recorded stage, which makes repeated or unknown finalization a no-op. All state and snapshots are guarded by a threading.RLock, because --log-stats runs a real OS thread that reads the same sliding-window buffers the event loop mutates.
Terminal outcomes are explicit: on_request_complete for normal backend exhaustion, on_request_fail for a backend or transport error, and on_request_abort for client disconnect or cancellation.
Behavior changes worth noting:
finished_requestsnow counts normal exhaustion only. Aborted and failed attempts no longer increment it. A response whose body is read to completion counts as exhaustion even when its status is 4xx or 5xx.- Abandoned streams are recorded as
status="aborted"invllm:request_latency_seconds. They were previously recorded assuccess, because the status defaulted to success and cancellation bypassed the error handler. - A request body that is not JSON-parsable now returns 400. It previously raised
TypeErrorand surfaced as a 500, becauseHTTPException(status=...)is an invalid keyword — the parameter isstatus_code. - Failed failover attempts now retire. Each attempt owns its own handle and finalizes in its own
finally, so an attempt that fails against one engine no longer leaves a count behind on it.
The lifecycle fix guarantees that a terminating attempt retires its counters; socket timeouts guarantee that attempts terminate. Proxied backend requests previously used ClientTimeout(total=None) — no bound of any kind — so an engine that vanished without closing the connection (node death, TCP black hole, dropped SYNs) hung the request and its stage count forever, and the failover loop never ran because it only sees failures, not silence.
Backend requests now default to --backend-connect-timeout 10 s and --backend-read-timeout 300 s (0 disables either). total stays None: the read bound is on silence, not duration — it re-arms on every byte received, so a stream that keeps producing tokens can run for hours, and aiohttp suspends the watchdog while the router applies backpressure to a slow client, so a slow reader cannot trip it either. Every silent phase of an attempt is covered: DNS resolution and connection establishment by the connect bound (ClientTimeout.connect + sock_connect), the wait for response headers and gaps mid-stream by sock_read, and the request-body upload — where sock_read is not yet armed, so a backend that accepts the connection but stops reading would otherwise hang a large multimodal payload forever — by an entry deadline of connect + read (310 s by default) that is disarmed the moment response headers arrive.
On breach, the client gets a structured answer instead of a bare 500 or a silent connection reset:
- Connect-phase failures (
ConnectionTimeoutError, connection refused) rotate to the next engine; when every permitted failover attempt has failed, the router returns 502 with an OpenAI-style envelope —{"error": {"message": …, "type": "bad_gateway", "code": "backend_connect_error", "param": null}}. - Read/entry timeouts before response headers return 504 immediately —
codeisbackend_read_timeout(read gap or header wait) orbackend_entry_timeout(connect + upload + header deadline),typeisgateway_timeout, and the message carries the configured bound. They deliberately do not rotate backends: the stall is workload-shaped, and a retry would typically eat the same bound on the next engine, multiplying worst-case latency. - Mid-stream stalls on SSE responses (status already committed) end with an in-band terminal event —
data: {"error": {…, "code": "backend_stream_stall"}}followed bydata: [DONE]— and a clean close, mirroring the engine's own streaming error contract. Non-SSE bodies keep the abrupt close: a truncated body must not be dressed up as success.
Every error response carries X-Request-Id and Retry-After: 1. Each timeout logs one structured WARNING (request id, backend, model, endpoint, elapsed, which bound fired) with no traceback, the counters retire through the ordinary fail path, and the error stays visible as request_errors_total{error_type="ConnectionTimeoutError"|"SocketTimeoutError"|"TimeoutError"}.
A non-streaming generation — headers arrive only when generation finishes — or a deeply queued request whose backend stays silent longer than 300 s is now terminated with the 504 above rather than waiting indefinitely. Raise --backend-read-timeout (or set 0) if your workloads legitimately stay silent longer; prefer streaming for very long generations.
Note that vllm:num_requests_running is exported by the router under the same metric name vLLM engines export natively. Dashboards and autoscaler queries should filter by job or component to avoid selecting the router-derived series. The stock autoscalers are unaffected: the router HPA scales on CPU, and the engine KEDA trigger uses vllm:num_requests_waiting from the engine scraper.
If you launch the router with --dynamic-config-yaml (or --dynamic-config-json), that file is your single source of truth: you do not also need to spell the fork's flags out in the command: array. Every flag the router accepts — including the fork's startup-only ones below — can be set as a key in that file.
The backend timeouts and upstream keep-alive setting take these config keys:
| Config key | Flag | Default |
|---|---|---|
backend_connect_timeout |
--backend-connect-timeout |
10.0 |
backend_read_timeout |
--backend-read-timeout |
300.0 |
timeout_keep_alive |
--timeout-keep-alive |
5 |
Example:
service_discovery: static
routing_logic: roundrobin
static_models:
my-model:
static_backends:
- http://vllm-worker:8000
# Startup-only settings
backend_connect_timeout: 10.0
backend_read_timeout: 300.0
timeout_keep_alive: 5Three things to know:
- Keys use underscores, not dashes. The config key is
backend_read_timeout, matching the flag's destination — notbackend-read-timeout. A dashed key has no effect at startup and is rejected by the watcher on reload. - These flags are read once, at startup. Restart to change their effective values. Backend timeout edits are inert to the watcher (logged at
debug).timeout_keep_aliveis a legacy dataclass field: editing it triggers a reconfiguration but does not change uvicorn's keep-alive timeout. Only the hot-reloadable settings (static_backends,routing_logic,callbacks, …) take effect on a live edit; the watcher re-reads the file every 10 seconds. - A key that is not a recognized flag is rejected, and your running config is kept. If the watcher re-reads the file and finds a key that is neither a hot-reloadable field nor a known flag — almost always a typo (e.g.
callbackinstead ofcallbacks) — it logs a warning and does not reconfigure, so the running configuration is preserved rather than silently reverting the mistyped field to its default. Fix the typo and the next reload applies cleanly.
| Blog | Docs | Production-Stack Slack Channel | LMCache Slack | Interest Form |
English · 简体中文
- 📄 Official documentation released for production-stack!
- ✨ Cloud Deployment Tutorials for Lambda Labs, AWS EKS, Google GCP are out!
- 🛤️ 2026 roadmap is released! Join the discussion now!
- 🔥 vLLM Production Stack is released! Check out our release blogs posted on January 22, 2025.
We host bi-weekly community meetings at the following timeslot:
- Every other Tuesdays at 5:30 PM PT – Add to Calendar
All are welcome to join!
vLLM Production Stack project provides a reference implementation on how to build an inference stack on top of vLLM, which allows you to:
- 🚀 Scale from a single vLLM instance to a distributed vLLM deployment without changing any application code
- 💻 Monitor the metrics through a web dashboard
- 😄 Enjoy the performance benefits brought by request routing and KV cache offloading
- How To Install Kubernetes (kubectl, helm, minikube, etc)?
- How to Deploy Production Stack on Major Cloud Platforms (AWS, GCP, Lambda Labs, Azure)?
- How To Set up a Minimal vLLM Production Stack?
- How To Customize vLLM Configs (optional)?
- How to Load Your LLM Weights?
- How to Launch Different LLMs in vLLM Production Stack?
- How to Enable KV Cache Offloading with LMCache?
The stack is set up using Helm, and contains the following key parts:
- Serving engine: The vLLM engines that run different LLMs.
- Request router: Directs requests to appropriate backends based on routing keys or session IDs to maximize KV cache reuse.
- Observability stack: monitors the metrics of the backends through Prometheus + Grafana
We are actively working on this project and will release the following features soon. Please stay tuned!
- Autoscaling based on vLLM-specific metrics
- Support for disaggregated prefill
- Router improvements (e.g., more performant router using non-python languages, KV-cache-aware routing algorithm, better fault tolerance, etc)
- A running Kubernetes (K8s) environment with GPUs
- Run
cd utils && bash install-minikube-cluster.sh - Or follow our tutorial
- Run
vLLM Production Stack can be deployed via helm charts. Clone the repo to local and execute the following commands for a minimal deployment:
git clone https://github.com/vllm-project/production-stack.git
cd production-stack/
helm repo add vllm https://vllm-project.github.io/production-stack
helm install vllm vllm/vllm-stack -f tutorials/assets/values-01-minimal-example.yamlThe deployed stack provides the same OpenAI API interface as vLLM, and can be accessed through kubernetes service.
To validate the installation and send a query to the stack, refer to this tutorial.
For more information about customizing the helm chart, please refer to values.yaml and our other tutorials.
helm uninstall vllmThe Grafana dashboard provides the following insights:
- Available vLLM Instances: Displays the number of healthy instances.
- Request Latency Distribution: Visualizes end-to-end request latency.
- Time-to-First-Token (TTFT) Distribution: Monitors response times for token generation.
- Number of Running Requests: Tracks the number of active requests per instance.
- Number of Pending Requests: Tracks requests waiting to be processed.
- GPU KV Usage Percent: Monitors GPU KV cache usage.
- GPU KV Cache Hit Rate: Displays the hit rate for the GPU KV cache.
See the details in helm/README.md
The router ensures efficient request distribution among backends. It supports:
- Routing to endpoints that run different models
- Exporting observability metrics for each serving engine instance, including QPS, time-to-first-token (TTFT), number of pending/running/finished requests, and uptime
- Automatic service discovery and fault tolerance via the Kubernetes API
- Model aliases
- Multiple routing algorithms:
- Round-robin routing
- Session-ID based routing
- Prefix-aware routing (WIP)
Please refer to the router documentation for more details.
We welcome and value any contributions and collaborations. Please check out CONTRIBUTING.md for how to get involved.
This project is licensed under Apache License 2.0. See the LICENSE file for details.
We are grateful to our sponsors who support our development and benchmarking efforts:
For any issues or questions, feel free to open an issue or contact us (@ruizhang0101, @ApostaC, @YuhanLiu11, @Shaoting-Feng).

