When should you choose Cloud Run over Compute Engine on GCP ?
Answer
Compute Engine provides classic virtual machines, where you manage the operating system, scaling and maintenance yourself, giving full control but requiring more operations work. Cloud Run is a serverless platform that runs containers with no infrastructure management: it scales automatically, including down to zero instances when there's no traffic, and bills for actual usage rather than machine uptime. Cloud Run fits well for stateless web apps and APIs with variable traffic, while Compute Engine remains relevant for workloads that need fine-grained control over the environment or predictable continuous operation.
Common trap
The trap is forgetting about cold starts with Cloud Run when the instance count has scaled down to zero: the very first request after a period of inactivity takes longer to respond while an instance spins up, which can be an issue for an API with strict latency requirements.