Google Cloud Run Memory Limit Calculator
Cloud Run gives each instance a single memory limit; an instance that exceeds it is shut down and its in-flight requests fail. How much memory an instance needs depends on how many requests it serves at once, and sizes above 4 GiB also need more vCPUs. This calculator sizes the limit from peak usage and adds the CPU Cloud Run requires for it.
01 Usage data
Where do I get these numbers?
Cloud Monitoring charts Cloud Run memory as a share of the current limit, not in bytes. Multiply the service's "Container memory utilization" p50 and p99 over a representative period by its current limit, and enter them under Manual values. Only the p99 (the peak) changes the result.
If you export container metrics to Prometheus, or have per-instance values with units (412 MiB), paste those here instead.
Enter observed per-instance usage directly, in MiB.
02 Workload profile
Advanced: margins and defaults
Values the result relies on that are our own defaults, or vendor defaults your setup may change. Each “?” says how one moves the result; the guide says where it comes from.
03 Sizing gauge
04 gcloud command
—
05 How this was derived
How every number is calculated, with sources and assumptions (opens in a new tab) ↗
Result looks wrong? Report it
Memory limit, CPU and concurrency in short
Each instance gets one memory limit, 512 MiB by default, up to 32 GiB; an instance that exceeds it is terminated. The container's filesystem is in memory, so files it writes use the instance's memory too. Cloud Run docs
With no separate reservation and running out ending the instance, the calculator sizes the limit from the peak alone; the average doesn't change the result. The margin is MemoryLimit's own default; you can change it under Advanced.
Google's own formula counts requests: standing memory plus memory per request times concurrency. The calculator applies it when you enter the instance's idle memory and the concurrency now and planned. Up to 4 GiB it leaves CPU at the default 1 vCPU; above that it adds the fewest vCPU the memory needs. Cloud Run docs
Common input mistakes
- Using the utilization metric as if it were MiB: we read it as a share of the instance's current limit, so multiply its p99 by that limit to get the peak in MiB.
- Planning a higher concurrency without entering the idle memory: the whole peak counts as per-request memory, so the result is an upper bound.
- A measured peak taken with fewer requests in flight than the maximum concurrency you entered: memory per request, and the planned memory, come out low.
Full derivation, warnings and every assumption: how the Cloud Run calculator works. The shared formula and margin tables: the sizing model.
Related calculators: