5.3.10 · D1MLOps & Deployment

Foundations — Model serving frameworks (TorchServe, Triton)

2,040 words9 min readBack to topic

Before you touch Model serving frameworks (TorchServe, Triton) you must be able to read its language without stumbling. This page builds every symbol from nothing. Nothing here assumes you have seen a GPU, a queue, or a millisecond budget before. We go slow on purpose.


0. What is "a request"? (the atom everything is built on)

Picture a counter at a shop. A customer walks up (a request arrives), hands over a slip (the input), waits, and receives an answer (the prediction). The whole page is about that counter: how long each customer waits, and how many we can serve.

Figure — Model serving frameworks (TorchServe, Triton)

Everything below — latency, throughput, batching — is just careful bookkeeping about this queue of customers.


1. Time and its unit: the millisecond (ms)

Why this unit and not seconds? Serving happens fast. A good model answers in single- or double-digit milliseconds. If we measured in seconds every number would be like , hard to read. In milliseconds it becomes — human-friendly. So the whole topic lives in ms.


2. Latency: how long ONE request takes

Picture a stopwatch started when the customer hands over the slip and stopped when they get the answer. The reading on that stopwatch is latency.


3. Throughput: how MANY requests per second

Picture the shop's daily headcount: not how long one customer waited, but how many customers walked out satisfied per minute. That is throughput.

Figure — Model serving frameworks (TorchServe, Triton)

4. The GPU: why a "bus, not a taxi"

Why does serving care? A GPU is happiest when you hand it a big pile of numbers all at once. Handing it one number wastes almost all of its parallel lanes — like driving an empty bus.

You'll meet the deeper reason in GPU architecture & kernel launch overhead; for now hold this picture: many lanes, best filled full.


5. The two costs of running the model: and

This is the single most important pair of symbols in the whole topic. We build them from a stopwatch.

Picture baking cookies. Preheating the oven takes a fixed 8 minutes () whether you bake 1 cookie or 100. Each cookie then adds a little baking time (). The oven-preheat is the fixed overhead; the per-cookie time is the marginal cost.

Figure — Model serving frameworks (TorchServe, Triton)

This one formula, , is the seed from which the parent's batching maths grows. If you understand why appears once and appears times, you understand batching.


6. Batch size : the size of the pile

Picture loading the bus: is the number of passengers you let on before you drive off. is a taxi (one rider, drives immediately). is a bus that waited to fill up.

Recall Why does

beat paying per request? Serial cost is — you pay B times. Batched cost is — you pay once. The saved 's are the whole win.


7. Queue wait and delay budget: waiting to fill the bus

To fill a bus you must let earlier passengers wait for later ones. That waiting is . The server caps it with a knob called max queue delay (e.g. 5 ms): "never make anyone wait longer than this before we drive off, even with an empty seat."

Figure — Model serving frameworks (TorchServe, Triton)

8. Concurrency : running several buses at once

Picture opening more counters in the shop. Batching makes each counter serve a group at once; concurrency adds more counters. They are different levers — combine both.


9. Speedup : the payoff number

Why a ratio? A ratio strips away the units and answers the only question you care about: did batching help, and by how much? Same-time = ; twice-as-fast = ; the bigger the better.

The parent proves this ratio can never exceed . You don't need that limit yet — just know is "the batching payoff," a pure number.


10. Symbols you'll see referenced but not derived here

Symbol / term Plain meaning Where it's built fully
(lambda) arrival rate — requests per second coming in Little's Law & queueing theory
the latency 99% of requests beat (tail, not average) Latency SLAs & p99
ONNX / .mar / TensorRT file formats that store a model ONNX & model interchange, Model quantization & TensorRT
Ensemble a chain of models run as one call parent note

You will meet these in context; this table just stops them from feeling like magic when they appear.


Prerequisite map

a request = one inference

latency in ms per request

throughput requests per sec

GPU many lanes fill full

two costs c fixed and m per sample

time to run T = c + B m

batch size B pile of requests

speedup S the payoff

queue wait w to fill the bus

concurrency N many copies

Model serving frameworks

Read it top-down: the request atom splits into the two things we measure (latency, throughput); the GPU picture forces the two costs and ; those plus batch size give the time formula, which gives speedup and wait; concurrency multiplies throughput — all feeding the topic.


Equipment checklist

Cover the right side, answer, then reveal. If any answer is fuzzy, re-read that section before the parent note.

1 request means how many inferences?
Exactly one — one question, one model run.
How many milliseconds are in a second?
1000, so .
Latency answers which question?
"How long did one request wait?" (per-customer).
Throughput answers which question?
"How many requests finish per second?" (crowd/sec).
Why is a GPU "a bus not a taxi"?
It has thousands of parallel lanes; feeding it one input wastes almost all of them.
What does stand for and what are its units?
Fixed overhead paid once per batch (kernel launch + data transfer), in ms.
What does stand for and what are its units?
Marginal compute added per extra sample, in ms per sample.
Write the time to process a batch of size .
.
Why does appear once but appear times?
The setup (oven-preheat) is paid once for the whole pile; each sample adds its own .
What is in plain words?
The number of requests grouped into one forward pass — passengers on the bus.
What is the queue wait ?
Time a request sits in line while its batch fills, in ms.
What are the three parts of ?
Queue wait + batch compute + network .
What is concurrency , and how does it differ from batching?
= number of parallel model copies (more counters); batching = one copy serving a group at once. Orthogonal knobs.
What does speedup mean?
Batching gave no improvement at all — exactly as fast as serial.
What does (lambda) denote, and where is it built?
The arrival rate (requests/sec); built in Little's Law & queueing theory.