What NVIDIA Triton Inference Server solves in production
Teams serving only one OpenAI-compatible text model often start directly with vLLM or SGLang. As soon as a stack adds an ONNX reranker, a TensorRT vision encoder, custom Python preprocessing, and strict per-model GPU concurrency limits, maintaining separate custom FastAPI containers creates network hops, serialization overhead, and inconsistent telemetry.
| Serving setup | Best workload fit | Who owns batching and scheduling |
|---|---|---|
| Standalone vLLM / SGLang | Single-model OpenAI-compatible chat and completion APIs | Engine continuous batcher and paged KV manager |
| Triton (TensorRT / ONNX / Python) | Embeddings, vision, audio, classifiers, and multi-stage pipelines | Triton dynamic batcher, sequence batcher, and instance groups |
| Triton + vLLM / TensorRT-LLM backend | Mixed pipelines combining LLMs with non-LLM models under KServe v2 | LLM backend owns continuous batching; Triton acts as decoupled gateway |
Per Triton’s architecture guide, the server separates client protocol handling from model-specific execution backends. One Triton process exposes HTTP/REST, gRPC, and C API endpoints implementing the KServe v2 inference protocol while dispatching tensors to TensorRT, ONNX Runtime, PyTorch, Python, vLLM, or TensorRT-LLM workers.
Model repositories, config.pbtxt, and dynamic batching
Every deployment starts with a structured model repository directory where each model owns a folder containing config.pbtxt and numbered version subdirectories (1/, 2/). The Triton model configuration declares tensor shapes, data types, execution placement, and scheduling policy:
- `instance_group`: Controls how many independent execution instances of a model load on each GPU (
KIND_GPU) or CPU (KIND_CPU), letting multiple CUDA streams run concurrently up to VRAM and compute limits. - `dynamic_batching`: Collects individual stateless requests (such as embedding or classification calls) into larger GPU batches using
preferred_batch_sizeand a boundedmax_queue_delay_microsecondswindow. - `sequence_batching`: Routes stateful multi-step requests sharing a correlation ID to the same model slot so recurrent state or streaming audio chunks stay ordered.
- `rate_limiter`: Bounds concurrent model executions across shared GPUs so high-priority models or large batches do not starve neighboring endpoints.
On the wire, Triton accepts standardized KServe v2 inference requests over HTTP or gRPC. Here is a valid minimal JSON request for a batched text-embedding model:
{
"id": "req-4091",
"inputs": [
{
"name": "input_ids",
"shape": [1, 4],
"datatype": "INT64",
"data": [[101, 2054, 2003, 102]]
},
{
"name": "attention_mask",
"shape": [1, 4],
"datatype": "INT64",
"data": [[1, 1, 1, 1]]
}
]
}How a request moves through NVIDIA Triton Inference Server
- KServe v2 endpointAccept HTTP/gRPC tensors or binary shared-memory handles.
- Scheduler & batcherGroup stateless calls or route sequences and ensembles.
- Backend instancesRun TensorRT, ONNX, Python BLS, or decoupled vLLM/TRT-LLM.
- Response or streamReturn batched outputs or emit async decoupled token chunks.
Model Triton dynamic batching latency vs. GPU utilization
Dynamic batching solves a classic small-request problem: launching a GPU kernel on batch size 1 wastes most of the step on launch overhead and weight loads. Setting max_queue_delay_microseconds holds the first waiting request briefly so concurrent arrivals coalesce into one efficient batch. Run this standalone discrete-event simulator in Python 3 to see why zero delay can actually hurt both p95 latency and GPU headroom under bursty arrivals.
import math, random
# Discrete-event simulation of Triton dynamic batching on a 4-request burst workload
rng = random.Random(7)
arrivals = []
t = 0.0
for i in range(800):
t += 200.0 if (i % 4) else 3400.0 # 4-request burst every 4 ms (~1000 req/s)
arrivals.append(t + rng.uniform(0.0, 50.0))
arrivals.sort()
def simulate(max_delay_us, max_batch=16):
idx, gpu_free, busy_us = 0, 0.0, 0.0
queue = []
latencies, waits, batches = [], [], []
while idx < len(arrivals) or queue:
while idx < len(arrivals) and arrivals[idx] <= gpu_free:
queue.append(arrivals[idx])
idx += 1
if not queue:
gpu_free = arrivals[idx]
continue
batch_start = gpu_free
deadline = queue[0] + max_delay_us
while len(queue) < max_batch and idx < len(arrivals) and arrivals[idx] <= deadline:
batch_start = max(batch_start, arrivals[idx])
queue.append(arrivals[idx])
idx += 1
batch = queue[:max_batch]
queue = queue[max_batch:]
exec_us = 2200.0 + 300.0 * len(batch) # fixed launch overhead + per-item compute
busy_us += exec_us
finish = batch_start + exec_us
gpu_free = finish
batches.append(len(batch))
for arr in batch:
waits.append((batch_start - arr) / 1000.0)
latencies.append((finish - arr) / 1000.0)
latencies.sort()
p95 = latencies[math.ceil(0.95 * len(latencies)) - 1]
util = 100.0 * busy_us / gpu_free
return sum(batches) / len(batches), sum(waits) / len(waits), p95, util
print("Triton dynamic batching simulation (800 requests, max_batch_size=16):")
for delay_us in (0, 2000, 8000):
avg_b, avg_w, p95_ms, util = simulate(delay_us)
print(f" max_queue_delay={delay_us:4d} us -> avg_batch={avg_b:4.1f} | wait={avg_w:4.2f} ms | p95={p95_ms:5.2f} ms | GPU busy={util:4.1f}%")Triton dynamic batching simulation (800 requests, max_batch_size=16):
max_queue_delay= 0 us -> avg_batch= 3.1 | wait=1.18 ms | p95= 5.57 ms | GPU busy=99.6%
max_queue_delay=2000 us -> avg_batch= 4.0 | wait=0.30 ms | p95= 4.02 ms | GPU busy=84.6%
max_queue_delay=8000 us -> avg_batch= 8.5 | wait=3.84 ms | p95=12.88 ms | GPU busy=55.3%At 0 us, the server fires immediately on the first arriving item, leaving the remaining three burst items waiting behind a 2.5 ms kernel and saturating GPU busy time at 99.6%. Giving the batcher a 2,000 us (2 ms) coalescing window lets all four burst requests execute together, lowering both p95 latency (4.02 ms) and GPU occupancy (84.6%). Pushing the window to 8,000 us drops GPU occupancy to 55.3% while trading off tail latency (12.88 ms).
Ensembles, Business Logic Scripting, and decoupled LLM backends
Real inference workflows chain multiple models. Triton provides two orchestration primitives inside the server process so intermediate tensors stay in GPU or shared memory instead of round-tripping over HTTP:
- Static ensembles (`platform: "ensemble"`): Declare a directed acyclic graph in
config.pbtxtconnecting step outputs to downstream inputs (for example, tokenizer -> embedding model -> classifier). See the Triton ensemble models guide. - Business Logic Scripting (BLS): Run arbitrary Python control flow inside a Python-backend model to issue asynchronous
pb_utils.InferenceRequestcalls, enabling conditional branching, guardrails, retries, and early exits. - Decoupled transaction mode for LLMs: Unlike single-response models, an autoregressive LLM produces zero or many streamed chunks per request. Decoupled models let a backend such as the Triton vLLM backend stream tokens asynchronously while its own internal scheduler runs continuous batching and paged KV management.
Four Triton configuration mistakes to catch before launch
- Enabling Triton dynamic batching in front of vLLM or TensorRT-LLM. LLM backends use iteration-level continuous batching internally. Always configure
max_batch_size: 0withmodel_transaction_policy { decoupled: True }on LLM backends so Triton forwards requests directly without stalling on a request-level batch window. - Oversubscribing GPU `instance_group` counts. Spawning four GPU instances of a large model rarely quadruples throughput; it multiplies resident weight memory and causes SM context thrashing. Measure VRAM first in our GPU memory calculator and validate utilization versus cost in the inference cost calculator.
- Skipping `model_warmup` in `config.pbtxt`. TensorRT plan initialization, CUDA graph capture, and lazy kernel JIT compilation make the first live request seconds slower. Define warmup samples in
config.pbtxtso Kubernetes readiness probes turn green only after kernels are warm. - Sending large tensors as HTTP JSON arrays. Serializing float embeddings or image tensors as text JSON blows up CPU usage and payload size. Switch high-throughput paths to gRPC binary payloads, KServe binary HTTP extensions, or CUDA shared memory, and cross-check engine model support in the compatibility directory.
NVIDIA Triton Inference Server FAQ
Should I use Triton or standalone vLLM for a single LLM endpoint?
Standalone vLLM or SGLang is simpler when you only need an OpenAI-compatible chat API for one LLM. Choose Triton when you serve multi-model pipelines (embeddings, vision, TensorRT engines, Python logic) or require a unified KServe v2 control plane across frameworks.
Why must max_batch_size be 0 for the Triton vLLM backend?
Because vLLM schedules tokens step-by-step across sequences of varying lengths inside its own continuous batcher. Setting a non-zero Triton max_batch_size forces Triton’s request-level batcher to pad or hold requests before vLLM ever sees them.
When should I pick an Ensemble over Business Logic Scripting (BLS)?
Use an Ensemble whenever the pipeline DAG is fixed at deployment time (such as preprocessing into a TensorRT engine), because Triton executes static DAG routing in C++ without Python overhead. Use BLS when you need loops, conditional routing, or dynamic retries.
What replaces Triton dynamic batching when a model tracks conversation or audio state?
Use sequence_batching with explicit sequence start/end flags and correlation IDs so Triton pins every chunk of a session to the same stateful model instance slot.
Sources and further reading
Primary documentation and research behind this guide.
- NVIDIA Triton Inference Server: Architecture
- NVIDIA Triton Inference Server: Model Configuration (config.pbtxt)
- NVIDIA Triton Inference Server: Ensemble Models
- NVIDIA Triton Inference Server: Decoupled Models
- NVIDIA Triton Inference Server: vLLM Backend
- KServe v2 Inference Protocol Specification (Triton Server)
