Scaling online serving
Professional Machine Learning Engineer · Lesson 14 of 19 · 1:43:32
YouTube loads only after you press play. This chapter opens at its timestamp in the full course. Watch on YouTube ↗
Learning with these videos? Subscribe for new courses and exam-style questions.
Subscribe on YouTube (opens in a new tab)In this lesson
Prepare for the Google Cloud Professional Machine Learning Engineer exam, on the official exam guide. In this lesson: endpoint types (dedicated public, shared public, and private endpoints with Private Service Connect), online features from Feature Store, serving hardware, autoscaling with minimum and maximum replicas, reservations, Spot VMs, the optimized TensorFlow runtime, and co-hosting models. Includes three original practice questions, with Cymbal Insurance, a fictional car and home insurer, as the example.
Study notes
The text of this lesson, to read at your own pace. Information as of November 2026.
Storm season
During storm season, claims traffic at Cymbal Insurance triples within hours, and the fraud endpoint slows down. The security team wants no inference traffic on the public internet. And finance asks why six small models each pay for their own machine.
Endpoint types
Agent Platform offers four kinds of endpoints. A dedicated public endpoint, the recommended public option, isolates your traffic, and supports larger payloads and longer timeouts. A shared public endpoint is simpler, and it is the only kind that can serve a tuned Gemini model. A dedicated private endpoint, using Private Service Connect, is recommended for production enterprise applications, because requests and responses stay on private networking. And the older private endpoint uses VPC Network Peering.
Serving features online
Many models need fresh features at the moment of the request, like a customer's claims in the last ninety days. The app, or the model's preprocessing step, fetches them by entity ID from a Feature Store feature view, through Bigtable online serving. The features come from the same BigQuery definitions used in training, which avoids skew. So the request carries only an ID, and the serving side adds the rest.
Hardware and autoscaling
Match the serving hardware to the model. CPUs serve small and tabular models, GPUs serve deep learning models and large language models, TPUs can serve large models at high throughput, and edge devices serve offline. Autoscaling adds or removes replicas between a minimum and a maximum replica count, following a target such as CPU or accelerator use. A minimum of at least one replica keeps the first requests fast, and the maximum caps the cost during spikes. Reservations assure capacity for critical endpoints, while Spot VMs cost much less, but can be taken back at any time.
Lower latency and cost
Several levers cut latency and cost in production. The optimized TensorFlow runtime serves TensorFlow models faster, and at a lower cost, than open source TensorFlow Serving containers, with optional precompilation. Co-hosting groups several models in one deployment resource pool, so small models share the same machines. And keep endpoints in the callers' region, send requests in small batches when the app allows it, and prefer smaller models when they meet the target.
Recap
Let's recap. Dedicated public endpoints and private endpoints with Private Service Connect are the recommended choices, and tuned Gemini models use shared public endpoints. Online features come from a Feature Store feature view, by entity ID. CPUs, GPUs, TPUs, and edge devices each fit different models. Autoscaling moves between a minimum and a maximum replica count, with reservations for capacity and Spot VMs for cost. And the optimized TensorFlow runtime and co-hosting lower latency and cost.
Quick checks for this lesson
The 3 questions of this lesson, as plain text. The button above runs them with shuffled choices and the reason behind every choice.
For a production fraud endpoint, security requires that requests and responses never cross the public internet, and asks for the recommended option. Which endpoint fits?
- A dedicated public endpoint
- A shared public endpoint
- A dedicated private endpoint with Private Service Connect
- A private endpoint with VPC Network Peering
Show the answer
A dedicated private endpoint with Private Service Connect
A dedicated private endpoint, using Private Service Connect, keeps requests and responses on private networking, and it is the recommended private option. “A dedicated public endpoint” is reached over the public internet. “A shared public endpoint” is also public, and shared. And “A private endpoint with VPC Network Peering” is private, but it is the older option, not the recommended one.
The fraud endpoint runs two replicas all year. During storms, traffic triples within hours, and latency climbs. What should the team change?
- Run six replicas all year
- Autoscaling with a higher maximum replica count
- Batch inference every night
- Only Spot VMs for the endpoint
Show the answer
Autoscaling with a higher maximum replica count
Autoscaling with a higher maximum replica count adds replicas during storms, and removes them afterward. “Run six replicas all year” would pay for six replicas all year, for a few days of storms. “Batch inference every night” would make each answer wait for a nightly job. And “Only Spot VMs for the endpoint” could be taken back at the worst moment, exactly when traffic peaks.
Six small models are deployed on six endpoints, each on its own machine, and each machine sits mostly idle. Finance wants a lower serving cost. What should the team do?
- Co-host them in one deployment resource pool
- Give each model a larger machine
- Raise each endpoint's minimum replica count
- Replace them all with batch jobs
Show the answer
Co-host them in one deployment resource pool
Co-hosting puts the six models in one deployment resource pool, so they share the same machines. “Give each model a larger machine” would raise the cost, with even more idle hardware. “Raise each endpoint's minimum replica count” would leave every machine just as idle. And “Replace them all with batch jobs” would give up online answers, which the apps still need.