5.3.16 · D3MLOps & Deployment

Worked examples — Cost optimization and inference latency

2,602 words12 min readBack to topic

This page is the drill hall for Cost optimization and inference latency. The parent gave you the formulas; here we run them through every case class — every sign, every limit, every degenerate input — so no scenario can surprise you in an interview or an outage.

We only use three formulas from the parent. Let us pin them down first so every symbol is earned.


The scenario matrix

Each cell below is a case class — a qualitatively different situation the maths can produce. The worked examples that follow are labelled with the cell(s) they cover.

# Case class What is special about it Covered by
A Low load small waiting ≈ 0, latency ≈ service time Ex 1
B High load the utilization cliff, near-divergence Ex 2
C Overload formula breaks — queue is infinite Ex 3
D Zero / degenerate or empty inputs, sanity limits Ex 4
E Compute-bound big , tiny queue latency set by arithmetic, not waiting Ex 5
F Cost vs throughput move how scales when you batch Ex 6
G Real-world word problem pick replica count to hold an SLA Ex 7
H Exam twist solve backwards for the max safe Ex 8
I Combined limit batching helps and hurts at once Ex 9

Worked examples


Recall Rebuild the whole matrix from one formula

? Use . ? Latency is infinite — add replicas. ? Latency . Big , empty queue? Latency . Want cheaper? Raise ; cost falls as . Want to size replicas? Set a cap from your latency budget, then .

Which cell is "the formula gives a negative number" a symptom of?
Case C — overload, , mean latency is actually infinite.
To hold a latency SLA, do you cap or first?
Cap from the budget, then convert to .
Batching's double effect in one line?
Raises (cost via ) but raises (latency via ).
What three assumptions does T1 (M/M/1) make?
Poisson arrivals, exponential service times, and a single server.