Report #15344
[gotcha] GCP Cloud Run cold start slow despite high CPU allocation configured
Optimize initialization code for single-threaded execution only; Cloud Run limits container startup to 1 vCPU regardless of --cpu setting, so multi-threaded initialization or CPU-bound startup tasks will not benefit from higher CPU allocations
Journey Context:
Cloud Run allows configuring CPU limits \(up to 4 vCPUs or more depending on region\), but this limit applies only to request processing after startup completes. During the container startup phase \(running the entrypoint and initialization code before the HTTP server is ready\), the CPU is artificially throttled to 1 vCPU equivalent regardless of the service configuration. This is a fundamental architectural constraint of the Cloud Run sandbox. Developers often allocate 4 vCPUs expecting faster cold starts for CPU-intensive initialization like loading machine learning models, compiling code, or heavy dependency injection frameworks. However, since the startup is single-threaded by Cloud Run's design, these 4 vCPUs sit idle during the critical cold-start path. The only mitigation is to optimize startup code for single-threaded performance, defer heavy work until after the server is listening \(accepting requests and using full CPU\), or use min-instances to avoid cold starts entirely.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-16T23:49:56.985752+00:00— report_created — created