Google Associate Cloud EngineerEnsuring successful operation of a cloud solutionMedium
A developer needs to deploy a containerized machine learning inference service that experiences unpredictable traffic patterns, with long periods of inactivity followed by sudden bursts of requests. The service must scale to zero to minimize costs during idle times. Which Google Cloud compute option is the most cost-effective and appropriate for this scenario?
- ACompute Engine with custom machine images
- BCloud Run
- CCloud Functions
- DGoogle Kubernetes Engine (GKE) Autopilot
Show answer & explanationAnswer & explanation
Correct answer: B. Cloud Run
Cloud Run is a fully managed serverless platform that allows deploying stateless containers, scales automatically from zero to handle bursts of traffic, and only charges for the resources consumed during active requests, making it ideal for unpredictable workloads and cost-efficiency.
Why the other options are wrong
- A. Compute Engine instances, even with custom images, incur costs when idle and require manual configuration for scaling, which is not cost-effective for unpredictable, bursty workloads that need to scale to zero.
- C. Cloud Functions are serverless, but they are designed for event-driven functions, not typically for containerized services that might require more complex runtime environments or custom binaries beyond simple functions.
- D. GKE Autopilot manages the underlying infrastructure, but it's designed for continuous workloads or applications that need more control over infrastructure, and it doesn't scale to zero in the same cost-effective manner as Cloud Run for individual services.
Cloud Run
A fully managed serverless platform for deploying stateless containers that scales automatically, including to zero instances, and charges only for consumed resources.
- Deploys stateless containers
- Scales to zero for cost efficiency
- Pay-per-use billing model
- Ideal for microservices and APIs with unpredictable traffic
Memory trick: Serverless: No servers, no worries, no wasted money.