This page describes how to specify the number of CPUs to use for each Cloud Run instance. By default, Cloud Run container instances are limited to 1 CPU. You can increase or decrease this value as described in this page.
Set and update CPU limits
By default, each instance is limited to 1 CPU. You can change this to any of the values shown in the following table.
CPU and memory table
The following are minimum memory requirements for CPUs:
CPUs | Minimum memory |
---|---|
1 | 128 MiB |
2 | 128 MiB |
4 | 2 GiB |
6 | 4 GiB |
8 | 4 GiB |
Required roles
To get the permissions that you need to configure and deploy Cloud Run worker pools, ask your administrator to grant you the following IAM roles:
-
Cloud Run Developer (
roles/run.developer
) on the Cloud Run worker pool -
Service Account User (
roles/iam.serviceAccountUser
) on the service identity
For a list of IAM roles and permissions that are associated with Cloud Run, see Cloud Run IAM roles and Cloud Run IAM permissions. If your Cloud Run worker pool interfaces with Google Cloud APIs, such as Cloud Client Libraries, see the service identity configuration guide. For more information about granting roles, see deployment permissions and manage access.
Configure CPU limits
Any configuration change leads to the creation of a new revision. Subsequent revisions will also automatically get this configuration setting unless you make explicit updates to change it.
You can set CPU limits for a Cloud Run worker pool using the Google Cloud CLI when you create a new worker pool or deploy a new revision:
gcloud
You can update the CPU limits for a given worker pool by using the following command:
gcloud beta run worker-pools update WORKER_POOL --cpu CPU
Replace
- WORKER_POOL with the name of your worker pool
- CPU with the CPU limit. Specify the value
1
,2
,4
,6
, or8
CPUs, following the requirements shown in the CPU and memory table.
You can also set CPU during deployment using the command:
gcloud beta run worker-pools deploy --image IMAGE_URL --cpu CPU
Replace
- IMAGE_URL with a reference to the container image that
contains the worker pool, such as
us-docker.pkg.dev/cloudrun/container/worker-pool:latest
. - CPU with the value
1
,2
,4
,6
, or8
CPUs, following the requirements shown in the CPU and memory table.
View CPU configuration for the worker pool
In the Google Cloud console, go to Cloud Run:
Click Worker pools to display the list of deployed worker pools.
Click the worker pool you want to examine to display its details pane.
Click the Containers tab to display CPU configuration for the worker pool.