Troubleshooting Cloud Run Scaling Limits Under High Load

PCD By islever Editorial Last updated

Short answer

D Check whether the Cloud Run service has scaled to a number of instances that equals the max-instances value. If necessary, increase the max-instances value.

Question

You are developing a public web application on Cloud Run. You expose the Cloud Run service directly with its public IP address. You are now running a load test to ensure that your application is resilient against high traffic loads. You notice that your application performs as expected when you initiate light traffic. However, when you generate high loads, your web server runs slowly and returns error messages. How should you troubleshoot this issue?
  1. Check the network traffic to Cloud Run in Cloud Monitoring to validate whether a traffic spike occurred. If necessary, enable traffic splitting on the Cloud Run instance to route some of the traffic to a previous instance revision.
  2. Check the min-instances value for your Cloud Run service. If necessary, increase the min-instances value to match the maximum number of virtual users in your load test.
  3. Check whether Cloud Armor is detecting distributed denial of service (DDoS) attacks and is blocking traffic before the traffic is routed to your Cloud Run service. If necessary, disable any Cloud Armor policies in your project.
  4. Check whether the Cloud Run service has scaled to a number of instances that equals the max-instances value. If necessary, increase the max-instances value. Correct Answer

Key Takeaways

When Cloud Run services experience slow performance and errors under high traffic, the issue is typically hitting the max-instances scaling limit. Increasing the max-instances value resolves the bottleneck by allowing more concurrent instances to handle the load.

Expert Analysis

External Application Load Balancer with IAP secures the service behind Google identity, replacing direct public IP exposure. Cloud Armor alone (A) is WAF/DDoS. IAM (B) controls GCP access. Cloud NAT (C) is for outbound internet.

The scenario presents a classic performance bottleneck in serverless environments: hitting the upper limits of auto-scaling capacity under high load. When a Cloud Run service is subjected to traffic that exceeds its current instance count, requests are queued or rejected if the max-instances limit has been reached. The symptom described—"web server runs slowly and returns error messages" specifically under high loads while performing well under light traffic—is the definitive signature of scaling exhaustion. In this context, "slowly" often refers to the latency incurred by request queuing before an instance becomes available, and "error messages" likely refer to HTTP 503 Service Unavailable errors when the queue is full or the max instances are hit.

Option D is the correct troubleshooting step because it directly addresses the scalability ceiling. Cloud Run scales based on concurrent requests up to the max-instances value configured for the service. If the load test generates more concurrent connections than the allowed maximum, new requests cannot be served immediately. Increasing the max-instances value allows the platform to provision more containers to handle the concurrency, thereby reducing latency and preventing rejection errors. This is the primary lever for ensuring resilience against high-traffic spikes in Cloud Run.

Option A suggests checking Cloud Monitoring and enabling traffic splitting. Traffic splitting is a deployment feature used for canary releases or blue/green deployments, allowing traffic to be routed between different revisions of a service. It does not increase capacity or resolve scaling bottlenecks. Checking monitoring is good practice, but enabling traffic splitting will not help the application handle more concurrent users; it merely changes how traffic is distributed among existing revisions. Therefore, this action is irrelevant to the performance issue.

Option B recommends increasing the min-instances value to match the number of virtual users. This is fundamentally flawed for two reasons. First, min-instances ensures that a specific number of instances are always running and ready to serve requests, eliminating cold starts. However, setting min-instances equal to the maximum number of virtual users in a load test would result in massive cost inefficiency, as those instances would remain idle during low-traffic periods. Second, even if you pay for many idle instances, they do not solve the problem if the max-instances limit is still low. If max-instances is set to 10, having min-instances set to 100 is impossible (min cannot exceed max) or simply wastes resources without allowing additional scaling beyond the max cap. The constraint here is the maximum capacity, not the minimum baseline.

Option C involves checking Cloud Armor for DDoS blocking. While Cloud Armor can block traffic, the reference explanation clarifies that Cloud Armor is primarily a Web Application Firewall (WAF) and DDoS protection layer. If Cloud Armor were blocking the traffic, the application would not "run slowly"; it would return immediate HTTP 403 Forbidden or 429 Too Many Requests errors at the edge, before reaching the Cloud Run service. The description of the server running slowly implies the traffic is reaching the application logic but struggling to process it, which points to internal resource constraints (scaling limits) rather than external security filtering. Furthermore, blindly disabling Cloud Armor policies is a security anti-pattern and does not address the root cause of the scaling limitation.

The key mechanism here is the distinction between min-instances (warm capacity) and max-instances (capacity ceiling). Under high load, the system hits the ceiling. Troubleshooting requires expanding that ceiling, not adjusting the floor or misapplying deployment features.

Official Reference

https://cloud.google.com/run/docs/configuring/min-instances

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

Exam Strategy

Always distinguish between min-instances and max-instances in Cloud Run scenarios. Min-instances prevent cold starts and ensure availability during low traffic, while max-instances define the absolute capacity ceiling during high traffic. If a question describes performance degradation specifically under heavy load, look for options related to increasing the max-instances limit. Avoid distractors involving traffic splitting (a deployment feature) or Cloud Armor (a security feature), as these do not address compute capacity constraints.

Practice All PCD Questions

Access 84 questions with complete answers and detailed explanations.

View Full PCD Practice Test →

← Back to PCD Study Guide