Configure CPU limits for services

This page describes how to specify the number of vCPUs to use for eachCloud Run instance. By default, Cloud Run container instancesare limited to 1 vCPU. You can increase or decrease thisvalue as described in this page.

This page also describes how to enable or disablestartup CPU boost, a feature that temporarily increases vCPUallocation during instance startup in order to reduce startup latency.

Note: in addition to specifying the number of vCPUs to use, you can also specifywhether vCPUs are allocated for the lifetime of the instance or onlyallocated during request processing. For details, refer toBilling settings.

Set and update vCPU limits

By default, each instance is limited to 1 vCPU.You can change this to any of the values shown in the following table.

vCPU and memory table

The following are memory requirements for vCPUs:

CPUsMemory required
.08 vCPUUp to 512 MiB
.5 vCPUUp to 1 GiB
1 vCPUUp to 4 GiB
2 vCPUUp to 8 GiB
4 vCPU2 to 16 GiB
6 vCPU4 to 24 GiB
8 vCPU4 to 32 GiB

Alternatively, if you want to use less than 1 vCPU, you can select any valuebetween 0.08 and 1, in increments of 0.001. Values greater than 1 must be integervalues.If you use less than 1 vCPU, the following requirements are enforced:

SettingRequirement
MemoryA minimum of 0.5 vCPU is needed to set amemory limit greater than 512MiB.
A minimum of 1 vCPU is needed to set a memory limit greater than 1GiB.
ConcurrencyMaximum concurrency must be set to1.
BillingThebilling settings must be set to request-based billing.
Execution environmentYou must use thefirst generation execution environment.
Note: When selecting a vCPU limit greater than 1 vCPU, consider yourapplication's threading model. If your application is single-threaded, it mayonly fully utilize one vCPU.

Maximum amount of vCPU

The maximum amount of vCPU you can configure is 8 vCPU.

Minimum amount of vCPU

The minimum vCPU setting is 0.08 vCPU.

Required roles

To get the permissions that you need to configure and deploy Cloud Run services, ask your administrator to grant you the following IAM roles:

If you are deploying aserviceorfunction from source code, youmust also have additional roles granted to you on your project andCloud Build service account.

For a list of IAM roles and permissions that are associated withCloud Run, seeCloud Run IAM rolesandCloud Run IAM permissions.If your Cloud Run service interfaces withGoogle Cloud APIs, such as Cloud Client Libraries, see theservice identity configuration guide.For more information about granting roles, seedeployment permissionsandmanage access.

Configure CPU limits

Any configuration change leads to thecreation of a new revision. Subsequent revisions will also automatically getthis configuration setting unless you make explicit updates to change it.

You can set CPU limits using the Google Cloud console, the gcloudcommand line, or a YAML file when youcreate a new service ordeploy a new revision:

Console

  1. In the Google Cloud console, go to Cloud Run:

    Go to Cloud Run

  2. SelectServices from the Cloud Run navigation menu, and clickDeploy container to configure a new service.If you are configuring an existing service, click theservice, then clickEdit and deploy new revision.

  3. If you are configuring a new service, fill out the initial servicesettings page, then clickContainer(s), Volumes, Networking, Security to expand theservice configuration page.

  4. Click theContainer tab.

    image

    • Select the desired CPU limit from the dropdownlist, usingCustom if you want to use less than 1 CPU. Select a value of1,2,4,6, or8CPUs, or for less than 1 CPU,specify a value from 0.08 to less than 1.00, in increments of 0.01. (See the table underSetting and updating CPU limits for required settings.)
  5. ClickCreate orDeploy.

gcloud

You canupdate the CPU limitsfor a given service by using the following command:

gcloudrunservicesupdateSERVICE--cpuCPU

Replace the following:

  • SERVICE: the name of your service.
  • CPU: the desired CPU limit. Specify the value1,2,4,6, or8CPUs, or for less than 1 CPU,specify a value from 0.08 to less than 1.00, in increments of 0.01. (See the table underSetting and updating CPU limits for required settings.).

You can also set CPU duringdeployment using the command:

gcloudrundeploy--imageIMAGE_URL--cpuCPU

Replace the following:

  • IMAGE_URL: a reference to the container image, forexample,us-docker.pkg.dev/cloudrun/container/hello:latest. If you use Artifact Registry,therepositoryREPO_NAME mustalready be created. The URL follows the format ofLOCATION-docker.pkg.dev/PROJECT_ID/REPO_NAME/PATH:TAG.
  • CPU: the value1,2,4,6, or8CPUs, or for less than 1 CPU,specify a value from 0.08 to less than 1.00, in increments of 0.01. (See the table underSetting and updating CPU limits for required settings.)

YAML

  1. If you are creating a new service, skip this step.If you are updating an existing service, download itsYAML configuration:

    gcloudrunservicesdescribeSERVICE--formatexport>service.yaml
  2. Update thecpu attribute:

    apiVersion:serving.knative.dev/v1kind:Servicemetadata:name:SERVICEspec:template:metadata:name:REVISIONspec:containers:-image:IMAGEresources:limits:cpu:CPU

    Replace the following:

    • SERVICE: the name of your Cloud Run service.
    • IMAGE_URL: a reference to the container image, forexample,us-docker.pkg.dev/cloudrun/container/hello:latest. If you use Artifact Registry,therepositoryREPO_NAME mustalready be created. The URL follows the format ofLOCATION-docker.pkg.dev/PROJECT_ID/REPO_NAME/PATH:TAG.
    • CPU: the desired CPU limit value.Specify the value1,2,4,6, or8CPUs, or for less than 1 CPU,specify a value from 0.08 to less than 1.00, in increments of 0.01. (See the table underSetting and updating CPU limits for required settings.)
    • REVISION with a new revision name or delete it (if present). If you supply a new revision name, itmust meet the following criteria:
      • Starts withSERVICE-
      • Contains only lowercase letters, numbers and-
      • Does not end with a-
      • Does not exceed 63 characters
  3. Create or update the service using the following command:

    gcloudrunservicesreplaceservice.yaml

Terraform

To learn how to apply or remove a Terraform configuration, seeBasic Terraform commands.

Add the following to agoogle_cloud_run_v2_service resource in your Terraform configuration:

resource"google_cloud_run_v2_service""default"{name="cloudrun-service-cpu"location="us-central1"deletion_protection=false # set to "true" in productiontemplate{containers{image="us-docker.pkg.dev/cloudrun/container/hello"resources{limits={          # CPU usage limitcpu="1"}}}}}

The precedinggoogle_cloud_run_v2_service resource specifies a CPU limitundertemplate.containers.resources.limits.

Replace1 with your desired CPU count. Tip:1 corresponds to 1 vCPU.

Set startup CPU boost

Thestartup CPU boost feature for revisions provides additional CPU duringinstance startup time and for10 seconds after the instance has started.

The actual CPU boost varies depending on your CPU limit settings:

CPU limitBoosted CPU
0-12
24
48
68
88

You are charged for the allocated boosted CPU for the duration of the container startup time.For example, if your container startup time is 15 seconds, and you allocate 2 CPU,with startup CPU boost, you'll be charged for 4 CPU during the (possibly shorter)instance startup time, including the 10 seconds after your container finished starting, andfor 2 CPU during the rest of the container lifecycle.

If your Cloud Run deployment uses sidecars, and you enable startupCPU boost, all containers receive the CPU boost. Cloud Run determinesthe boosted CPU amount for each container by the CPU limit.

You can enable or disable startup CPU boost using Google Cloud console,Google Cloud CLI, a YAML file, or a Terraform file.

Console

  1. In the Google Cloud console, go to Cloud Run:

    Go to Cloud Run

  2. SelectServices from the Cloud Run navigation menu, and clickDeploy container to configure a new service.If you are configuring an existing service, click theservice, then clickEdit and deploy new revision.

  3. If you are configuring a new service, fill out the initial servicesettings page, then clickContainer(s), Volumes, Networking, Security to expand theservice configuration page.

  4. Click theContainer tab.

    image

    • To enable startup CPU boost select the check boxStartup CPU boost. To disable this feature, deselect the checkbox.
  5. ClickCreate orDeploy.

gcloud

  1. You canenable startup CPU boostfor a given service by using the following command:

    gcloudrunservicesupdateSERVICE--cpu-boost

    ReplaceSERVICE with the name of your service.

    You can enable startup CPU boost duringdeployment using the command:

    gcloudrundeploy--imageIMAGE_URL--cpu-boost

    ReplaceIMAGE_URL with a reference to the container image, forexample,us-docker.pkg.dev/cloudrun/container/hello:latest. If you use Artifact Registry,therepositoryREPO_NAME mustalready be created. The URL follows the format ofLOCATION-docker.pkg.dev/PROJECT_ID/REPO_NAME/PATH:TAG.

  2. You candisable startup CPU boostfor a given service by using the following command:

    gcloudrunservicesupdateSERVICE--no-cpu-boost

    ReplaceSERVICE with the name of your service.

    You can disable startup CPU boost duringdeployment using the command:

    gcloudrundeploy--imageIMAGE_URL--no-cpu-boost

YAML

  1. If you are creating a new service, skip this step.If you are updating an existing service, download itsYAML configuration:

    gcloudrunservicesdescribeSERVICE--formatexport>service.yaml
  2. Update therun.googleapis.com/startup-cpu-boost attribute by specifying'true' to enable startup CPU boost or'false' to disable:

    apiVersion:serving.knative.dev/v1kind:Servicemetadata:name:SERVICEspec:template:metadata:annotations:run.googleapis.com/startup-cpu-boost:'true'

    ReplaceSERVICE the name of your Cloud Run service.

  3. Create or update the service using the following command:

    gcloudrunservicesreplaceservice.yaml

Terraform

To learn how to apply or remove a Terraform configuration, seeBasic Terraform commands.

Add the following to agoogle_cloud_run_v2_service resource in your Terraform configuration:

resource"google_cloud_run_v2_service""default"{name="SERVICE"location="REGION"template{containers{image="us-docker.pkg.dev/cloudrun/container/hello"resources{startup_cpu_boost=CPU_BOOST}}}}

Replace the following:

  • SERVICE: the name of your Cloud Run service.
  • REGION: the Google Cloud region—for example,europe-west1.
  • CPU_BOOST:true to enable startup CPU boost orfalse to disable it.

View CPU settings

To view the current CPU settings for yourCloud Run service:

Console

  1. In the Google Cloud console, go to the Cloud RunServices page:

    Go to Cloud Run

  2. Click the service you are interested in to open theService detailspage.

  3. Click theRevisions tab.

  4. In the details panel at the right, the CPU settingis listed under theContainer tab.

gcloud

  1. Use the following command:

    gcloudrunservicesdescribeSERVICE
  2. Locate the CPU setting in the returnedconfiguration.

Application threading and CPU utilization

When selecting a CPU limit greater than 1 vCPU, consider your application'sthreading model. When autoscaling, Cloud Run uses the average CPUutilization across all allocated CPUs. If your application is single-threaded,it may only fully utilize one core, which leads to a low average CPU utilizationeven under load. This can prevent CPU-based autoscaling from occurring asexpected.

To avoid this behavior for a single-threaded application, if your memoryrequirements allow it, we recommend starting with 1 vCPU. This results in better CPU-based autoscaling. Ifhigher memory needs force a multi-CPU selection for a single-threadedapplication, consider tuning yourconcurrency setting.

Except as otherwise noted, the content of this page is licensed under theCreative Commons Attribution 4.0 License, and code samples are licensed under theApache 2.0 License. For details, see theGoogle Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.

Last updated 2026-02-19 UTC.