Serve an MLflow registry model with FastAPI and BentoML: load by alias, validate requests, reload a new champion safely and load test p95 latency.
Saturday, 8:40 PM, the first hour of the acme-shop year-end sale. Checkout traffic is three times a normal weekend.
A prediction API is a contract between the model team and every caller.
Loading the model is the slowest thing your service does.
Bad input does not crash a fraud model. That is the problem.
A web API has two kinds of failure: the request is wrong, or the server is broken.
The model team promotes version 8 on Tuesday afternoon.
Saturday, 8:40 PM, the first hour of the acme-shop year-end sale. Checkout traffic is three times a normal weekend.
A prediction API is a contract between the model team and every caller.
Loading the model is the slowest thing your service does.
Bad input does not crash a fraud model. That is the problem.
A web API has two kinds of failure: the request is wrong, or the server is broken.
The model team promotes version 8 on Tuesday afternoon.
FastAPI gives you a web framework and leaves the ML parts to you.
The Docker module covered images, layers and multi-stage builds, and LLMOps and Production AI Systems covered auth...
You have a service that works for one request. The sale on Saturday sends 400 requests per second.
Every option in this section can serve acme-fraud correctly.
This lab turns everything above into a working service inside your mlops-lab project.
Quick reference Common mistakes Loading the model inside the request handler is the mistake behind this module's...
Roles that use the skills in this module.
AI Engineer
MLOps Engineer
Platform Engineer
Not a software engineer sheet. Every problem comes from real DevOps, SRE, Platform and Cloud interviews, from your first script to a system you build yourself.
Open the Coding SheetStart with FastAPI when you have one model, modest traffic and a team that already runs Python web services, because you control every line. Move to BentoML when you need adaptive batching, several models in one service or a standard packaging format that builds images for you. Both can load the same MLflow registry model, so the choice is reversible.
An alias such as champion lets the team promote or roll back a model by moving a pointer in the registry, without editing code or config in the service. The service should still resolve the alias to a fixed version once per load and report that version in every response. That way you get easy promotion and a precise record of which model made each decision.
Start with one worker, then load test while you watch p95 latency and memory. Add workers only while latency improves and memory allows, because every worker holds its own copy of the model and native libraries such as XGBoost start threads of their own. The right number depends on the CPU you allocate, the model size and the traffic you need to carry.
No. The test set is looked at once, at the end of model development, and serving checks run many times. Use a small sample of validation rows to prove the served model returns the same scores as the offline model. That parity check tests the serving code, not the model's quality.