Production Serving and Reliability
A fast model runner is only one component of a service. The production gate covers API semantics, lifecycle, overload, isolation, observability, rollout and recovery while preserving model quality.
Section 8 of 9 · 12 units · about 49 hours
By the end you can Meet the request and isolation contract under saturation, cancellation, worker death and bad rollout, then diagnose one seeded performance incident and one lifecycle or security incident from stored evidence and execute a clean drain and rollback.
Units
- Typed OpenAI-compatible schemas, token streaming and backpressure4h
- Deadlines, cancellation, authentication, quotas, validation and idempotency5h
- Router and load-balancer responsibilities, token- and cache-aware routing4h
- Weight loading, startup phases, warmup, readiness and graceful drain4h
- Compatibility checks, canary and blue-green rollout, and rollback4h
- Autoscaling signals, startup lag, failure reserve and degraded-mode headroom4h
- Overload, admission, load shedding and retry budgets3h
- Multi-tenant model and cache isolation, and prompt and trace privacy4h
- Per-request logs, metrics and traces, and engine and hardware telemetry4h
- Quality, availability, latency and error SLIs, SLOs and error budgets3h
- Worker, dependency, cache and bad-rollout failure injection5h
- Seeded incidents, runbooks, first-cause timelines and recovery load tests5h
Build it
Mini project · about 12 to 16 hours
Reliable gateway with quotas, shedding and recovery drills
Build the gateway/ around a fitting engine with auth, quotas, routing, shedding, telemetry, SLOs, canary and runbooks. Fault drills prove bounded detection and clean recovery before fleet scale.
- 1Serve typed chat completions with SSE down to
[DONE], per-request queue backpressure and a small fixed-schema structured output, checked against the ch03 stream tests and a vLLM stream. Keep raw bytes and reassembly. - 2Add API-key auth, a token-bucket limiter with
Retry-After, deadline propagation with upstream close, idempotent retries byx-request-id, and allow-listed media fetch, passing the Project 103 suite. Keep limiter and dedupe tests. - 3Implement token-aware and prefix-hash routing with adapter affinity and
FailOpenfallback, plus work-based admission with priority shedding and a budgeted breaker, checked against the day24 routing and burst drills. Keep replay counts and tail evidence. - 4Split cold start into provision, load and warmup with liveness, readiness and inference-health probes and drain, then run a canary with rollback on error and tail gates, sized by compatibility, replica and reserve math from the day26 drills. Keep timings and gate evaluations.
- 5Enforce per-tenant quotas with salted prefix isolation and a cross-key attack drill, emit per-request logs, metrics and traces joined by
request_id, and compute tiered SLOs with budget burn and goodput from raw records using the ch16 and ch17 bundles. Keep isolation and dashboard evidence. - 6Kill a fitting engine under load to show bounded detection, reroute and rejoin, climb the degradation ladder through dependency and cache drills, roll back a bad version on canary gates, and write runbooks with first-cause timelines proven by recovery load tests. Keep all drill evidence.
What you hand in
gateway/with auth, quotas, routing, shedding, probes, canary and SLO dashboards plus tests.- Isolation, telemetry and fault evidence: salted-cache tests, attack drill, traces and budget burn.
- Runbooks with first-cause timelines and recovery load-test evidence showing clean return to SLO.
How to check it
- Self-grade with the rubric below
- llm-model-inference ch03 streaming tests
Assert stream framing and concurrent isolation; then assert
[DONE]on vLLM. - Project 103 API and middleware tests
Pass all seven stubbed tests for auth, limits and streaming.
- 100 Days day24 routing and burst
Run routing, hash-ring and burst drills; port the ring to gateway.
- 100 Days day26 canary and recovery
Rerun canary scenarios and drain; write timelines from stored evidence.
- AI Systems ch16 monitoring bundle
Deploy monitors under load and show one alert with overhead.
- AI Systems ch17 QoS gates
Port tiered gates and show premium passing under pressure.
How it's graded
Gateway and routing
Pass: Stream suites pass with [DONE] reassembly, limiter and dedupe tests pass, and routing with shedding shows tiered burst protection.
Great: A slow-reader case grows queues without pausing generation, and breaker trips are measured.
Isolation and SLOs
Pass: Quota and salted-cache tests show no cross-tenant hit, telemetry joins by request_id, and SLOs with goodput come from raw records.
Great: The key attack drill names first cause, and tier burn is tracked through the burst.
Failure and recovery
Pass: Worker, dependency, cache and bad-version drills store detection and recovery evidence, and runbooks with timelines execute cleanly.
Great: Recovery load tests return queues, KV and tails inside SLO with every request accounted.
Resources
- vLLM Online Serving, Architecture and Production MetricsvLLM Project
Trace the API server, engine core, scheduler, KV manager and model runner, then map documented metrics to your SLIs. The link is pinned to v0.31.0; add the auth, tenant, quality and rollout controls the engine leaves to you.
- Hands-On LLM Serving and Optimization - Chapters 3 and 4, serving system designChi Wang and Peiheng Hu (O'Reilly)
Read Chapter 3 (an online service from scratch, batching with streaming, multi-model trade-offs) and the enterprise-architecture part of Chapter 4. Convert the designs into explicit request, model-lifecycle and failure state machines.
- vLLM Production MetricsvLLM Project
Define every selected queue, cache, phase and request metric, check histogram buckets and measure exporter overhead. Add model version, cancellation, rejection, quality sample and tenant-safe trace fields in the surrounding service.
- Machine Learning Systems, Volume 2 - Inference at Scale and Serving Fault ToleranceHarvard (Vijay Janapa Reddi)
Read "Load Balancing and Request Routing", "Multi-Tenancy and Isolation" and "Autoscaling and Global Infrastructure" in Inference at Scale, then "Serving Fault Tolerance" and "Graceful Degradation" in the Fault Tolerance chapter.
- Gateway API Inference ExtensionKubernetes SIG Network
Study model-aware routing, endpoint selection and operational integration. Use it for architecture and an optional local deployment only after the service passes lifecycle and failure tests without Kubernetes.
- AI Systems Performance Engineering - Production Inference LabsChris Fregly
Use Chapter 16 monitoring, cache health, capacity planning and load-test utilities, then Chapter 17 routing only if distributed. Add process death, overload and bad-version cases that the performance pairs do not cover.
- Inference Engineering - Chapter 7, ProductionPhilip Kiely (Baseten Books)
Read Chapter 7 for containers, autoscaling, cold starts, routing and queueing, zero-downtime deployment, cost estimation and client-side streaming. Skip the vendor section at its end.
- SGLang documentation - Production MetricsSGLang Project
Compare its metric names and phase boundaries with vLLM's, so your dashboards do not depend on one engine's vocabulary.
- 100 Days of LLM Inference - Days 22 to 26Elizabeth Thomas
Use the container, autoscaling, routing, capacity and zero-downtime notebooks as small operational simulations. Replace calendar order and fixed scale targets with the stage checkpoint and your hardware limits.
- AI Infrastructure Engineer Learning - Project 103 LLM DeploymentAI Infra Curriculum
Use its Docker, API, monitoring, Kubernetes and cost files as scaffolding only. Check its resource assumptions against your own model and GPU, and rerun any benchmark before reusing a result.
- LLM Inference Systems Laboratory - Operations and FailureRoadmap-Final
Complete production gateway, isolation, telemetry, canary, drain, rollback and fault campaigns. Store first-cause timelines and revise runbooks from observed blind spots.
- OpenAI API Reference - streaming, auth, rate limits and request IDsOpenAI
Read the chat streaming event shape with the
[DONE]terminator, bearer auth, rate-limit headers, andx-request-idwith caller-suppliedX-Client-Request-Id. vLLM is the implementation under test; use this only for the contract it claims compatibility with. - vLLM Multimodal Inputs - media validation, fetch policy and cache identityvLLM Project
Read Online Serving for image, video and audio inputs:
--allowed-media-domains, fetch timeouts,--limit-mm-per-prompt, local-media path restriction, and media UUIDs for cache identity. The link is pinned to v0.31.0.