Fix GCP Cloud Run Run Min Scale Errors
When working with GCP Cloud Run, you may encounter a configuration error that prevents your deployment from working. This guide explains the most common mistake with run min scale and shows the exact fix.
A Common Mistake
Setting min-instances to 0 (default), causing cold starts on every request after idle periods.
The incorrect command:
gcloud run deploy my-service --image=gcr.io/my-project/my-image --min-instances=0
Error output:
Deployed with 0 min instances.
After 15 minutes of no traffic:
curl https://my-service-xxxxx-uc.a.run.app
Response time: 8.2s (cold start includes container startup + request routing)
Subsequent requests: 200ms
The Correct Approach
The right way to configure run min scale in GCP Cloud Run:
gcloud run deploy my-service --image=gcr.io/my-project/my-image --min-instances=2
Successful result:
Deployed with 2 min instances.
After 15 minutes of no traffic:
curl https://my-service-xxxxx-uc.a.run.app
Response time: 250ms (no cold start)
Cost: 2 instances x 24h/day = ~$30/month for always-on compute.
How to Prevent This
Set min-instances for latency-sensitive production services. Calculate cost: 1 min-instance = 1 vCPU + memory always running. Use CPU always-on for services needing background processing. Monitor min-instances utilization in Cloud Monitoring. Consider traffic patterns before setting min-instances.
FAQ
Built by the developers of Doda Browser, DodaZIP, and Durga Antivirus Pro. Secure your cloud with DodaTech.
Built by the developers of DodaTech
Doda Browser, DodaZIP & Durga Antivirus Pro