7

Production

Operate inference as a reliable, observable, and cost-aware service.

12 min read

Printed pages: 177–208

Star on GitHub

In one breath

A fast graphics processing unit (GPU) process is not yet a production service. Package a reproducible runtime, understand its concurrency envelope, keep excess work in a bounded queue, scale replicas before latency fails, route each request to suitable state, and make cold starts short enough for the policy to react. Add capacity and failure domains deliberately, roll out with live evidence, secure data and weights, account for total cost of ownership (TCO), and observe the full request. Time to first token (TTFT) and tokens per second (TPS) matter, but client setup, network, queue, and protocol also consume the service-level agreement (SLA).

Why it matters

  • Production traffic tests assumptions that a benchmark holds fixed. Arrival bursts, long inputs, cache locality, user geography, and downstream slowness can turn a fast replica into an unreliable product.
  • Capacity is dynamic. Concurrency, batch size, queue depth, replica count, and cold-start time form one control problem; tuning any value alone can exchange idle cost for missed latency or overload.
  • At scale, hardware and providers fail during normal operation. Reliability comes from detecting unhealthy nodes, isolating failure domains, keeping alternate capacity ready, and exercising failover before an incident.
  • Users experience the client-to-server path, not kernel time. A reused connection, nearby workload, short queue, early stream, or asynchronous job can improve the product more than another local model speedup.

Mental model

Start with an immutable serving artifact. A container image layers a proven base, exact application and system dependencies, configuration, and an ephemeral runtime layer. Pin versions and remove unused packages so the image is reproducible, smaller, quicker to move, and easier to audit. Keep large model weights separate when they dominate image size, and cache compiled engines only with the exact hardware and software identity they require.

January 2026 edition snapshot: NVIDIA Inference Microservices (NIMs) package supported model and GPU combinations as ready-made containers, with flexible family images and more specialized model images. They can be a deployable service, reference, or base layer. Choose that opinionated starting point when its tested configuration fits; use a lower-level base when product constraints require control that adaptation would make harder.

Production is a measured control loop

Queue depth flows into Concurrency budget, whose saturation triggers Scaling policy; Scaling policy starts Cold-start path, ready replicas enter Routing, and Routing feeds Observability. Observability compares demand, latency, utilization, errors, and replica state, then sends a corrective signal back to Scaling policy.

  1. Queue depthHolds bounded excess work and exposes waiting demand
  2. Concurrency budgetMatches scheduler capacity to each replica
  3. Scaling policyCombines traffic and utilization with delays and limits
  4. Cold-start pathProcures hardware, loads image and weights, then starts engine
  5. RoutingPlaces work by capacity, sequence, cache, and adapter state
  6. ObservabilityCorrelates latency, errors, demand, utilization, and replica state
  • Queue depthConcurrency budget: Waiting work
  • Concurrency budgetScaling policy: Saturation or spare capacity
  • Scaling policyCold-start path: Add or replace replica
  • Cold-start pathRouting: Replica becomes ready
  • RoutingObservability: Requests and outcomes
  • ObservabilityScaling policy: Corrective signal

Measure the replica envelope before autoscaling. Continuous batching admits new sequences as slots open, but a larger active batch improves aggregate throughput while slowing each request. Set the engine batch limit and autoscaler concurrency target from the same test. Combine traffic with GPU utilization because request count is predictive while utilization reveals expensive sequence shapes. Add a measurement window, minimum and maximum replicas, cooldown, and headroom for forecast error.

A scale-up decision has value only after a replica is ready. Decompose cold start into hardware allocation, image transfer, weight transfer, and engine startup; shrink bytes, place caches near the GPU, and reuse compiled artifacts safely. While capacity arrives, hold work in a bounded first-in-first-out or priority queue. Once ready, route requests by load plus properties such as sequence length, key-value prefix state, or low-rank adaptation (LoRA) weights, and immediately drain queued work up to the new replica's limit.

Above one cluster, separate a global control plane from workload planes that can keep serving independently. Blend reserved capacity for baseline demand with on-demand or interruptible supply for peaks, place workloads near users, and avoid cross-cluster hops inside a multi-stage request. Active-active regions carry live traffic and fail over smoothly; active-passive capacity lowers steady use but makes readiness a critical test. Security policy must cover user data, model weights, infrastructure access, encryption, isolation, retention, and geographic processing constraints.

Deployment is a capacity event. Begin with manual and load tests, then shadow a sample of real traffic. A canary starts the new version at small volume, observes correctness, latency, errors, quality, and scaling, then increases traffic in guarded steps. Keep rollback available and prewarm enough replicas for each step; otherwise the canary measures a cold queue rather than the new service. This avoids the full duplicate GPU fleet required by a blue-green cutover.

Evaluate cost over a representative week. Compare an application programming interface (API) bill for input, output, and cache behavior with dedicated hardware cost under actual utilization, batch, and sequence distributions. Include engineering and operating labor in TCO. Observe request volume, sequence sizes, response codes, percentile latency, replica states, host and accelerator utilization, and queue depth together; logs and change audits explain the correlated movement and support rollback.

Treat the client as part of inference. Reuse transport layer security (TLS) sessions rather than paying setup on every request; for a 300-millisecond P95 objective, a TLS handshake can consume at least ten percent of the budget. Use synchronous Hypertext Transfer Protocol (HTTP) for bounded calls, asynchronous jobs and webhooks for long throughput work, WebSockets for continuous less-structured bidirectional streams, and gRPC for schema-defined service communication. WebSockets favor unstructured real-time data, while gRPC adds a predefined schema and validation for structured bidirectional streams.

Consider a burst that fills every replica just after scale-down. The queue preserves accepted work, but its oldest age begins consuming the SLA. Traffic and concurrency trigger scale-up before utilization alone would; the controller estimates whether cold-start completion will arrive in time. Admission closes or lowers priority when maximum capacity cannot meet deadlines. Newly ready replicas are discovered immediately and receive queued work only to their measured limit. After demand falls, cooldown keeps enough capacity through the likely second wave. This scenario tests the entire feedback loop, while a steady-state throughput test exercises only the engine.

Now remove a GPU node and a region while traffic continues. Health automation must stop new placement, cordon the node, replace affected replicas, and move regional demand without violating data-location policy. Existing workload planes keep serving even if the global controller is impaired. Active capacity absorbs the shift; standby capacity proves it is actually ready with correct artifacts, credentials, network policy, and routes. Operators trace interrupted requests and model-state exposure through audit logs. Recovery is complete only when latency, error rate, queue age, capacity margin, and security controls return to bounds, not merely when a replacement process starts; preserve the timeline to improve the runbook.

An incident timeline should connect product, system, and cost signals. A deployment may increase long inputs, which raises prefill utilization, deepens queues, triggers more replicas, lengthens cold starts by competing for bandwidth, and increases both latency and spend. Looking at any chart alone produces the wrong fix. Correlate release identity, request shape, routing choice, cache behavior, queue age, replica lifecycle, client timing, response codes, and cost allocation under one request and time window. Establish the causal chain before choosing rollback, input limits, routing changes, bandwidth, or more capacity. The same record later explains whether dedicated capacity still beats an API once idle headroom, resilience, and engineering labor are included.

Make data handling part of the serving contract. If inputs and outputs are not required after completion, avoid retaining them. If quality review, audit, or training requires storage, define purpose, region, duration, encryption, access, deletion, and incident evidence before collecting anything. Apply the same discipline to model weights, logs, caches, queues, and temporary artifacts because sensitive content can persist outside the primary database. Portability across providers is useful only when every destination enforces the same controls and geographic restrictions.

Core ideas

Known-good artifact

Containers preserve a fragile dependency chain across environments. Exact versions, a minimal filesystem, architecture-aware builds, an image registry, and immutable release identities make deployment repeatable and rollback possible.

Autoscaling is feedback

Traffic predicts demand; utilization shows work intensity. Concurrency and queues reveal saturation; cold-start delay determines how early to act. A stable policy combines all signals with bounds and cooldowns.

Placement follows useful state

Even load is the baseline, not the whole policy. Sequence cost, prefix cache, adapter residency, region, and replica readiness can make one destination much better than another.

Scale stages independently

Compound workloads give each detector, model, and decoder the hardware and replica policy it needs. Keep tightly coupled stages in one cluster when cross-cluster network time would consume the end-to-end budget.

Capacity needs failure domains

A multi-cloud design is not merely several isolated accounts. Global scheduling must see fungible pools, while each workload plane remains able to serve if the global controller or another region fails.

Correlate before concluding

Latency can rise because demand, input length, queueing, errors, or resource pressure changed. Put inference metrics beside application telemetry and deployment events so operators can distinguish cause from symptom.

Protocol follows interaction

Short request-response calls, hours-long jobs, token streams, live audio, and internal typed services need different connection lifetimes, acknowledgements, schemas, and backpressure behavior. Protocol choice governs product behavior and failure handling, not only serialization.

How it works

  1. Build a minimal image from a trusted engine base, pin every runtime and system dependency, scan it, attach an immutable release identity, and prove the same artifact starts on the target GPU architecture.
  2. Load-test representative sequences across concurrency levels. Choose the highest per-replica concurrency that still meets tail-latency and memory limits, then align engine batch and autoscaler target.
  3. Combine arrival rate, queue depth, active concurrency, compute, and memory signals. Scale early enough to cover measured cold-start delay; scale down only after a cooldown that spans ordinary traffic gaps.
  4. Time hardware allocation, image loading, weight loading, and engine initialization separately. Reduce size, increase local bandwidth, cache compatible builds, and alert when any stage regresses.
  5. Advertise readiness before routing. Bound the queue, apply priority intentionally, place work using load and reusable state, and stop admission or shed work predictably when maximum capacity is reached.
  6. Inject node loss, region loss, control-plane interruption, slow downstreams, and preemption. Verify health detection, isolation, rerouting, queue behavior, data policy, and recovery objectives with live-like load.
  7. Shadow a sample, launch a canary with prewarmed minimum capacity, advance traffic through explicit gates, and roll back automatically when correctness, quality, latency, errors, or cost leaves bounds.
  8. Measure from client send to useful output. Reuse sessions, choose sync, async, or streaming transport by interaction, propagate cancellation and backpressure, and include network plus client parsing in the latency trace.

Metrics that matter

Demand

requests/s and tokens/s

Slice by input and output length, region, model, cache status, adapter, and customer class.

End-to-end latency

P50, P90, P99

Break into client setup, network, queue, prefill, decode or model work, and response delivery.

Queue health

depth and wait age

Track oldest request, admission rejection, priority mix, and drain rate when replicas become ready.

Replica capacity

active concurrency

Pair batch occupancy and throughput with latency, accelerator memory, compute, and half-full replica count.

Cold start

seconds by stage

Report hardware, image, weights, engine, readiness, and the queue delay users experienced during scale-up.

Reliability

success and recovery

Monitor response-code rates, node health, failover time, interrupted requests, and capacity remaining after failure.

Economics

cost per accepted workload

Include reserved and burst GPUs, idle share, transfer, storage, testing, and engineering time over a representative period.

Streaming

connection and first useful output

Track active sessions, setup and reuse, backpressure, disconnects, bytes, underruns, and reconnect success.

Trade-offs

Ready-made or controlled image

January 2026 edition snapshot: a supported NIM or engine image reduces setup and captures known compatibility. A less opinionated base gives more control over kernels, dependencies, security, and startup but assigns their maintenance to the team.

Throughput or individual latency

More concurrent work improves utilization and total output until contention dominates, while each request waits longer. The chosen point must satisfy the SLA at production-shaped sequence distributions.

Warm capacity or cold cost

Higher minimum replicas and long scale-down delays absorb spikes quickly but pay for idle GPUs. Scale to zero saves on intermittent work but makes every first request depend on queue durability and cold-start speed.

Single cloud or pooled capacity

One provider is simpler to operate. Multiple providers increase capacity, locality, redundancy, and compliance options while adding a global scheduler, portability work, and more failure modes.

Blue-green or canary

Blue-green offers a complete parallel rollback environment but can double scarce GPU capacity. Canary rollout uses less spare hardware and exposes issues gradually, but requires strong gates and fast reversal.

Flexible stream or typed stream

WebSockets suit continuous unstructured payloads with application parsing. gRPC adds predefined schemas for service-to-service work, with validation and a small amount of additional overhead.

Engineering checklist

  • Revalidate every January 2026 vendor, engine, client, cloud, price, availability, compliance, and protocol statement before adoption.
  • Pin and scan the complete dependency tree, minimize the image, separate large weights, and record the hardware-compatible engine cache identity.
  • Measure concurrency, batch, latency, throughput, memory, and quality together on production-shaped traffic before setting autoscaling targets.
  • Bound every queue, define priority and admission policy, and test overflow, cancellation, retry storms, and replica discovery.
  • Budget and alert on each cold-start stage; ensure scale-up begins before the queue consumes the latency headroom.
  • Test node, cluster, region, provider, and control-plane failure; verify isolation, failover capacity, request recovery, and health automation.
  • Minimize retained user data, protect weights, encrypt traffic and storage, isolate workloads, restrict access, audit changes, and enforce residency policy.
  • Shadow realistic traffic, prewarm the canary, gate every traffic step, keep rollback live, and include autoscaling behavior in deployment approval.
  • Correlate demand, sequence shape, latency, codes, queue, replicas, utilization, logs, client timing, deployment events, and cost in one incident view.

Vocabulary

Container image
An immutable layered package containing the application and its required runtime files.
Continuous batching
A scheduler that admits new requests as token-level slots become available.
Cold start
The full delay from requesting capacity until a new model replica can accept traffic.
Router
A request-level component that chooses the most suitable serving destination.
Workload plane
A regional or clustered serving plane that handles inference and local scaling independently.
Canary deployment
A rollout that increases live traffic to a new release through monitored stages.
Observability
Correlated metrics, logs, alerts, and change history used to explain system state.
Asynchronous inference
A job pattern that acknowledges submission now and delivers a later result, often by webhook.

Source map

  • Pages 177-183

    Production framing, container layers, dependency discipline, prereleases, and NIMs.

  • Pages 183-192

    Autoscaling, batching, concurrency, cold starts, routing, queues, scale to zero, and stage scaling.

  • Pages 193-196

    Multi-cloud planes, GPU supply mechanisms, capacity blending, and geographic routing.

  • Pages 196-199

    Hardware failure, high-availability postures, security, compliance, and data location.

  • Pages 199-203

    Testing, canary rollout, API-versus-dedicated cost, and total ownership cost.

  • Pages 203-204

    Metrics, logs, alerts, and correlation with the rest of the application.

  • Pages 204-207

    Client overhead, session reuse, asynchronous work, streaming, WebSockets, and gRPC.

  • Page 208

    The edition-specific Baseten closing example and its four stated operating pillars.

Production framing, containers, image layers, dependencies, release pinning, and NIMs
Printed pages: 177–183; PDF pages: 179–185
Kubernetes, autoscaling signals, concurrency, batching, cold starts, routing, queues, scale to zero, and component scaling
Printed pages: 183–192; PDF pages: 185–194
Multi-cloud control and workload planes, GPU procurement, capacity mix, and geographic routing
Printed pages: 193–196; PDF pages: 195–198
Hardware failure, active-active and active-passive designs, security, compliance, and data residency
Printed pages: 196–199; PDF pages: 198–201
Testing, zero-downtime rollout, canaries, cost estimation, and total cost of ownership
Printed pages: 199–203; PDF pages: 201–205
Metrics, logs, alerts, causal diagnosis, and integration with application observability
Printed pages: 203–204; PDF pages: 205–206
Client overhead, connection reuse, asynchronous inference, streaming, HTTP, WebSockets, and gRPC
Printed pages: 204–207; PDF pages: 206–209
Edition-specific Baseten closing example and its stated operating pillars
Printed pages: 208–208; PDF pages: 210–210