WHAT tool: the p99 definition — "1% of individual calls exceed 900 ms" means each call has probability q=0.01 of being slow.
WHY this and not the mean: the mean hides the tail; the question is about any slow call across many, which is a probability-of-at-least-one problem.
A page is fast only if all100 calls are fast:
P(all fast)=(1−q)100=0.99100≈0.366
So
P(at least one slow)=1−0.366≈0.634≈63%.Lesson: a "rare" 1% tail becomes the common case under fan-out.
Recall Solution L1.2
WHAT tool:Lcompute≥F/(ηP) — work over achievable rate.
WHY ηP not P: real kernels never hit peak (memory stalls, launch overhead), so we divide by what the chip actually delivers.
Lcompute=0.4×2×10138×109=8×10128×109=10−3 s=1.0 ms.
Recall Solution L1.3
WHAT tool:ρ=λs — fraction of time the single server is busy.
WHY multiply:s is seconds-of-work per request, λ is requests per second, so λs is seconds-of-work arriving per second = busy fraction.
Convert s=25 ms=0.025 s:
ρ=20×0.025=0.5.
Server is 50% busy — safely below the danger zone.
WHAT tool:E[L]=s/(1−ρ) (M/M/1 mean, derived in the intro from Little's Law × the M/M/1 backlog ρ/(1−ρ)).
At ρ=0.5:
E[L]=1−0.525=50 ms.
Note the mean is 50 ms, but the tailp99 would be several times larger — the mean is a sizing guide, not the SLA number.
Double the load: ρ=40×0.025=1.0 — that's not allowed. ρ≥1 means work arrives faster than the server can clear it (λ≥μ); the queue grows without bound and E[L]→∞. The server is unstable. You must add a replica or shed load beforeρ reaches 1.
Recall Solution L2.2
WHAT tool:C1M=106H/(3600X).
WHY: cost per inference = (dollars/second) ÷ (inferences/second) = (H/3600)/X; scale to a million.
C1M=3600×150106×4.5=5.4×1054.5×106≈$8.33.
Recall Solution L2.3
WHAT tool: invert E[L]=s/(1−ρ) to solve for ρ.
WHY invert: we know the target latency and want the allowed load — the unknown moved to the other side.
100=1−ρ30⇒1−ρ=10030=0.3⇒ρ=0.7.
You may run up to 70% busy and still (in expectation) meet the mean budget. Caveat: if the real SLA is on p99, run lower than 0.7 and measure the tail — the mean is not the percentile.
(Compare configurations; reason about the trade-off.)
Recall Solution L3.1
Apply E[L]=40/(1−ρ):
ρ=0.6: 40/0.4=100 ms.
ρ=0.8: 40/0.2=200 ms.
ρ=0.95: 40/0.05=800 ms.
ρ=0.99: 40/0.01=4000 ms.
Growth factor: 4000/100=40×.
Read the figure (s01) carefully. The horizontal axis is utilization ρ from 0 to 1 on a linear scale; the vertical axis is mean latency E[L] in ms (also linear), fixed at s=40 ms. The blue curve is s/(1−ρ). Three features carry the lesson: (1) the green-shaded safe zoneρ<0.8 where the curve is nearly flat — adding load barely changes latency; (2) the sharp upward knee near ρ≈0.9; (3) the near-vertical wall as ρ→1 where the four marked dots climb 100→200→800→4000 ms. Toward the far left (ρ→0) the curve flattens to E[L]→s=40 ms — the no-queue floor: an almost-idle server just returns the raw service time, you can never go below s. (See Little's Law and Queueing Theory.)
Recall Solution L3.2
WHAT tool: throughput = items ÷ time; per-item compute latency = batch time (each item waits the whole batch).
Unit analysis for the throughput conversion (worked through): a batch of b items finishes in s(b)milliseconds. Raw rate is s(b) msb items. To convert ms→s we use the identity 1 s=1000 ms, i.e. multiply by 1 s1000 ms:
X=s(b)msbitems×1s1000ms=s(b)1000bsitems.
The "ms" cancels, leaving items/s — the factor 1000 is not arbitrary, it is this unit conversion. Now:
Read the figure (s02). Horizontal axis: batch size b (linear, 1 to 40). It has two vertical axes: the left one (green) is throughput X in items/s, the right one (red) is per-item latency in ms. The green throughput curve rises steeply then flattens (it saturates toward 1000/5=200 items/s as the fixed 20 ms is amortized away); the red latency line climbs straight and never bends (s(b)=20+5b is linear). The yellow dots mark b=1,8,32. The takeaway lives in the gap between the two curves: going b=1→32 multiplies throughput ≈4.4× (so cost per item drops ≈4.4×, since C∝1/X) but per-item latency grows 25→180 ms (7.2×). Throughput gains saturate while latency keeps climbing — the essence of the batching trade-off. See Batching and Throughput.
Recall Solution L3.3
Baseline floor: 12×109/(6×1012)=2.0 ms.
(a) Quantization: 12×109/(1.2×1013)=1.0 ms — a 2× speedup (see Model Quantization and Pruning).
(b) Distillation: 3×109/(6×1012)=0.5 ms — a 4× speedup (see Model Distillation).
Distillation wins on raw latency here (4× vs 2×), because it attacks F directly. But it needs retraining and risks accuracy loss; quantization is cheaper to deploy. In practice you often stack both: 12×109 FLOPs at F/4and2× hardware rate ⇒3×109/(1.2×1013)=0.25 ms (8×).
WHAT tool: per-replica capacity at target utilization. Recall the service rateμ=1/s from the intro — the requests one replica clears per second when always busy. Here μ=1/s=1/0.02=50 RPS. At the target ρ=0.75 we only let each replica take ρμ=0.75×50=37.5 RPS.
WHY the cap: running at ρ=0.75 keeps E[L]=20/(1−0.75)=80 ms — inside budget and with headroom to absorb the random bunching of arrivals (short bursts). The 25% idle is deliberate insurance, not waste.
R=⌈37.5300⌉=⌈8⌉=8 replicas.
Recall Solution L4.2
Total hourly spend = R \cdot H = 8 \times 2.40 = \19.20/hr.EffectiveaggregatethroughputX = 300 RPS.
$$C_{1M} = \frac{10^6 \times 19.20}{3600 \times 300} = \frac{1.92\times10^{7}}{1.08\times10^{6}} \approx \17.78.$$
Sanity note: we paid for 8×37.5=300 RPS of capacity and used all 300 — the 25% idle headroom is baked into needing 8 (not 6) machines, i.e. it's the price of meeting latency.
Recall Solution L4.3
(a) R=⌈300/93.75⌉=⌈3.2⌉=4 replicas.
(b) Hourly = 4 \times 2.40 = \9.60;X = 300:
$$C_{1M} = \frac{10^6 \times 9.60}{3600 \times 300} = \frac{9.6\times10^{6}}{1.08\times10^{6}} \approx \8.89.$$
Cost halved (\17.78 \to $8.89)—becauseweneedhalfthemachines.(c)A∗mean∗budgetcheckgives\approx 80 + 30 = 110ms.∗∗Butdonotreadthisasap99guarantee.∗∗Addingafixedbatch−waittoameanisalower−boundsketch:thetruetailisworsebecause(i)batch−waititselfvaries(somerequestsarrivejustasabatchcloses,otherswaitthefulltimeout),and(ii)queueingvarianceinflatesp99wellabovethemean.So110msmeanis∗plausibly∗safeagainsta150ms∗∗mean∗∗target,butforap99 \le 150msSLAyoumust∗∗measuretherealp99$** in load tests, not add means (see SLA SLO and Monitoring). The cost win is real; the latency claim is provisional until measured.
Verdict: Option B is 3.3× cheaper (\15vs$50)∗and∗meetsthemeanbudgetmorecomfortably—becausethesmallermodelbothcutss(morecapacitypermachine)andallowshighersafe\rho.∗∗Twocatches:∗∗(i)the1.5%accuracydrop—nevershipitblind,validateonheld−outandadversarialslices(see[[ModelDistillation]]);(ii)theseare∗mean∗budgets—beforelaunch,load−testandconfirmtherealp99$ meets the SLA, since the mean under-states the tail.
Recall One-line recap of every formula used
Compute floor ::: Lcompute≥F/(ηP)
Service rate ::: μ=1/s (requests one server clears per second when busy)
Queue latency ::: E[L]=s/(1−ρ), with ρ=λs=λ/μ
Max safe ρ from a mean budget ::: ρ=1−s/E[L]target
Replicas needed ::: R=⌈λ/(ρmaxμ)⌉
Cost per 1M ::: C1M=106H/(3600X)
Why mean ≠ SLA ::: percentile SLAs (p99) run above the mean; size on the mean, then measure the tail.