Choosing Minimum Instances for Google Cloud Run Gen 2 Services with Sporadic Traffic
0 reputation · 29 Mar 2024, 12:00 UTC
Determine the minimum‑instances value for a Google Cloud Run Gen 2 service that receives only occasional requests, aiming to reduce compute charges without exceeding an acceptable latency threshold.
The service can be configured with zero instances to eliminate baseline cost, but each request then incurs a cold‑start delay that varies with container image size, language runtime, and region. Setting the value to one or more reserves CPU continuously, removing cold‑start latency but adding a steady cost even when traffic is negligible.
Because the documentation does not give a formula for selecting the optimal trade‑off, the decision depends on workload‑specific latency tolerance, expected request frequency, and the measured cold‑start penalty in the target deployment region.
What latency increase is tolerable for users of this low‑traffic service? How does the container size affect cold‑start duration in the chosen region? At what average request rate does maintaining a single warm instance become more cost‑effective than paying repeated cold‑start penalties?