Cloud Run scales to zero for variable global traffic

PCD By islever Editorial Last updated

Short answer

B Cloud Run scales container instances to zero when idle, meeting the global, variable-traffic, scale-to-zero requirement.

Question

You are designing a globally available web application that must handle variable traffic loads and automatically scale to zero when idle. Which Google Cloud compute platform is the best choice?
  1. Compute Engine with managed instance groups
  2. Cloud Run Correct Answer
  3. GKE with static node pools
  4. App Engine flexible environment

Key Takeaways

Choosing a Google Cloud compute platform for variable traffic that must scale to zero when idle points to Cloud Run, because it provisions container instances on request and removes them entirely when traffic stops. Compute Engine MIGs and App Engine flexible instances keep running and billing during idle periods, while static GKE node pools add unavoidable cluster and node costs. Cloud Run's request-based autoscaling of container revisions delivers the scale-to-zero behavior the scenario demands.

Expert Analysis

B. Cloud Run auto-scales from traffic and scales to zero when idle, ideal for variable traffic with cost efficiency. Compute Engine with MIG (A) doesn't scale to zero. GKE with static pools (C) has cluster costs. App Engine flexible (D) always has instances.

The deciding constraint in this scenario is the phrase "automatically scale to zero when idle." Only Cloud Run satisfies that requirement outright: a Cloud Run service with the default request-based autoscaling provisions container instances (revisions) as HTTP requests arrive and, when traffic drops to nothing for the configured idle period, removes all instances so the service bills nothing while it waits. The workload stays globally reachable because Cloud Run fronts the container with a Google Cloud global HTTPS load balancer and anycast routing, so no instance needs to be resident in every region for the application to be "globally available."

Option A, Compute Engine with managed instance groups, fails on the same phrase. A MIG scales a pool of VM instances between a minimum and maximum size, and even a minimum size of zero only removes instances under a health-check-and-cooldown cycle — VM instances have boot time, and the group carries persistent disk and network costs while running. The scenario's variable traffic and idle periods map poorly onto VM lifecycle granularity, so A cannot honestly claim automatic scale-to-zero behavior.

Option C, GKE with static node pools, is disqualified twice over. "Static" means the node count does not track request volume at all, so there is no autoscaling to speak of; and a cluster's control plane and its resident nodes incur charges whenever the cluster exists, even with zero user traffic. Node pools could be configured with autoscaling, but the option as written removes that possibility by declaring them static, and the cluster itself never scales to zero.

Option D, App Engine flexible environment, runs your application inside VM-based instances managed by App Engine. Flexible instances are provisioned to run the runtime and do not scale to zero — they persist to serve traffic and incur cost during idle periods, and the environment is regionally bound rather than natively global. It scales out on load, but the idle-cost requirement rules it out.

A detail this scenario relies on but does not state: Cloud Run's autoscaling unit is a container instance (a revision), not a VM, and its concurrency model lets one instance handle many simultaneous requests. For example, a container configured with a concurrency of 80 can absorb a burst with a handful of instances instead of dozens of VMs, so the same service that shrinks to zero instances at night still absorbs a traffic spike with far fewer billed resources than a MIG or a static GKE pool would need — which is exactly why it wins on both "variable traffic loads" and "scale to zero when idle."

Official Reference

https://cloud.run/docs/about/autoscaling

This link opens the official vendor documentation in a new tab.

Exam Strategy

When a scenario names a hard behavioral constraint such as "scale to zero when idle," treat it as a filter and eliminate every option whose architecture cannot physically satisfy it — persistent VM pools, static node pools, and flexible-environment instances all keep billing with no traffic. Then confirm the surviving option also meets the remaining requirements (global reach, variable-load handling) rather than assuming one strength covers all constraints. On GCP compute questions, distinguish autoscaling of instances from autoscaling of cluster nodes, since a scaling node pool inside a non-zero cluster still fails a scale-to-zero requirement.

Practice All PCD Questions

Access 84 questions with complete answers and detailed explanations.

View Full PCD Practice Test →

← Back to PCD Study Guide