May we use cookies so Meta, Google, LinkedIn and ChatGPT see your visit and we learn which ads work? PrivacyMay we use cookies to see which pages help, and let Meta, Google, LinkedIn and ChatGPT see your visit, so we know which of our ads work? That way we spend less on ads that do not work. We do not sell your data, and the site works the same if you decline. You can change your answer at any time under Cookie settings at the foot of the page. Privacy policy
Loading...
AI Engineering · Serving And Inference
Free preview: the first 2 parts of this 32-part lesson.
Already bought the course? Sign in to read the whole lesson.
this lesson is part of
Generative AI and Agentic AI Engineering
Unlock this lesson and the 208 other paid lessons
$35 once, by card or PayPal
See the Generative AI and Agentic AI courseread the rest of this lesson in
Generative AI and Agentic AI Engineering
Unlock this lesson and the 208 other paid lessons
$35 once, by card or PayPal
See the Generative AI and Agentic AI coursein Serving And Inference
This lesson is part of the AI Engineering course. Unlock the full course, a separate one-time payment, for lifetime access.
One-time payment by card or PayPal
Get Lifetime AccessOne-time payment: UPI, card or netbanking
Get Lifetime AccessFoundation lessons of this course are free, no payment needed. Try them now
Let me start at a post office.
The manager wants to know how long customers wait at the one counter. She sends an inspector with a stopwatch. The inspector has a simple plan. He joins the line, waits, gets served, writes down his wait, and joins the line again. He does this all day.

At eleven o'clock the clerk goes to the back room for five minutes. The inspector is at the counter at that moment, so he waits five minutes and writes it down. That is one long wait in his notebook. But in those five minutes, thirty other people came in and stood in the line behind him. Each of them waited too, some for almost five minutes. None of them is in the notebook, because the inspector was busy waiting himself. At the end of the day his notebook says: almost every wait was short, and one was long.
A second inspector sits by the door instead. She writes down when each person walks in and when each person is served. Her notebook holds all thirty long waits.
A load tester for a web service can work like either inspector. In this lesson I test one small service both ways, and with a real tool, and I make the service stop on purpose, like the clerk. Then I check how far each report is from the truth.
This is lesson 7 of the chapter on serving a model. It uses the same model and the same service as the lessons before it, so I do not explain them again. The model is the features chapter's gradient boosted tree model. It scores one customer of a real online shop, with a test AP of 0.5450. The service is the small FastAPI web service from lesson 2, latency anatomy. It runs with one worker process and one thread. Lesson 5, workers and threads found that to be the best setting on one core.
Every earlier lesson needed a load test. Lesson 4, batching requests, built the open-loop client I use again here, and lesson 3, tail latency, explained percentiles. Lesson 6, cold start, measured what the first request pays. This lesson turns round and tests the testers.
A percentile says what share of requests were faster than a given time. The median, also called the p50, is the time that half of the requests beat, and the p99 is the time that 99 of every 100 beat.
The machine has one core. My AWS account may run only one virtual CPU at a time, so I rent the same one-core box as before. There is no second box for the tester. The tester and the service share the core, and that is one of the things I measure.
The question: when a load tester gives you a p99, how close is it to what users would really see?