Courseiva

Cloud Run Min Instances to Eliminate Cold Starts and Handle Traffic Spikes

A company uses Cloud Run for a serverless application that processes user uploads. Users report that sometimes the first request after a period of inactivity takes very long (cold start). The application is stateless. They want to minimize cold start latency while keeping costs low. The application is deployed with default settings: min instances = 0, max instances = 100, CPU always off, and a container image of 1GB. What should they do to reduce cold start latency?

Quick Answer

The answer is to set min instances to 1, which keeps a single warm instance always ready. This directly addresses the Cloud Run cold start problem because with the default min instances of 0, the service scales to zero during inactivity, forcing a full container initialization—including loading the 1GB image—on the next request. By maintaining one idle instance, you eliminate that latency for the first request after a traffic lull, while keeping costs low since you only pay for the single warm instance. On the Google Professional Cloud Developer exam, this scenario tests your understanding of the trade-off between cold start elimination and cost control; a common trap is assuming CPU always on or increasing max instances solves the issue, but those don’t prevent scale-to-zero. The key memory tip: “One warm instance beats a thousand cold starts”—min instances is your cost-effective lever for handling traffic spikes without the initial delay.

⚠ Common exam trap

The PCD exam often tests the misconception that increasing resources (memory or CPU) or enabling CPU always on reduces cold start latency, when in fact the root cause is the instance being scaled to zero and the solution is to keep at least one instance warm via min instances.

Answer choices

Why each option matters

Answer the question above first, then reveal the full breakdown to understand why each option is right or wrong.

Correct answer & explanation

Set min instances to 1 to keep a warm instance.

Setting min instances to 1 ensures that at least one instance is always warm and ready to serve requests, eliminating the cold start for the first request after a period of inactivity. Since the application is stateless and the default min instances is 0, Cloud Run scales down to zero, causing a cold start on the next request. By keeping one instance warm, you minimize latency without significantly increasing cost, as you only pay for the single idle instance.

Answer analysis

Option-by-option breakdown

For each option: why learners choose it and why it is or isn't the right answer here.

  • Set min instances to 1 to keep a warm instance.

    Why this is correct

    Keeping a minimum number of instances eliminates cold starts.

  • Increase container memory from the default to reduce startup time.

    Why it's wrong here

    More memory may help but not guarantee warm instances.

  • Use a larger container image to include more dependencies.

    Why it's wrong here

    Larger images increase cold start time.

  • Enable CPU always on allocation.

    Why it's wrong here

    CPU always on does not keep instances alive if min instances is 0.

Quick reference

Cloud Service Model Comparison

ModelYou ManageProvider ManagesExamples
IaaSOS, runtime, apps, dataHardware, hypervisor, networkingEC2, Azure VMs, GCP Compute Engine
PaaSApps and dataOS, runtime, middleware, hardwareElastic Beanstalk, Azure App Service
SaaSData and settings onlyEverything elseMicrosoft 365, Salesforce, Workday
FaaS / ServerlessFunction code onlyInfra, scaling, runtimeLambda, Azure Functions, Cloud Run
CaaSContainers and appsKubernetes, OS, hardwareEKS, AKS, GKE

About these practice questions

This PCD question is part of Courseiva's 964-question bank — original exam-style content with full explanations and wrong-answer analysis, never real exam questions or exam dumps. Learn why practice questions differ from exam dumps →

How Courseiva writes practice questions · Editorial policy

Same concept, more angles

2 more ways this is tested on PCD

These questions test the same concept from different angles. Work through them to make sure you can recognise it however the exam phrases it.

Variation 1. A team deploys a containerized application on Cloud Run and notices increased latency during traffic spikes due to cold starts. Which configuration change would best address this?

medium
  • A.Set min_instances to a value greater than 0
  • B.Set concurrency to 1
  • C.Enable CPU always allocated
  • D.Increase max_instances

Why A: Setting min_instances to a value greater than 0 keeps a baseline of warm instances ready to handle traffic, reducing cold starts. Option B is wrong because setting concurrency to 1 limits throughput, which can worsen scaling behavior and does not address cold starts. Option C is wrong because enabling CPU always allocated does not create new instances; it only prevents CPU throttling on existing instances. Option D is wrong because increasing max_instances only raises the upper limit of instances but does not prevent cold starts; it can help with scale but not with initial latency.

Variation 2. An application on Cloud Run needs to handle traffic spikes. Which configuration setting should be adjusted?

medium
  • A.Enable HTTP/2
  • B.Set min and max instances
  • C.Increase CPU allocation
  • D.Increase memory

Why B: Cloud Run automatically scales the number of container instances based on incoming traffic. By setting min and max instances, you control the scaling range: a minimum ensures a baseline of warm instances to absorb sudden spikes, while a maximum caps costs and prevents resource exhaustion. This is the primary lever for handling traffic spikes in a serverless environment.

JA

Written by Johnson Ajibi, MSc IT Security

Senior Network & Security Engineer · founder of Courseiva

This PCD practice question is part of Courseiva's free Google Cloud certification practice question bank. Courseiva provides original exam-style practice questions with explanations, topic-based practice, mock exams, readiness tracking, and study analytics to help learners prepare for the PCD exam.