Mantenha tudo organizado com as coleções
Salve e categorize o conteúdo com base nas suas preferências.
Esta página descreve como aumentar a vCPU para seus builds.
Por padrão, o Cloud Build executa seus builds em uma máquina virtual (VM) padrão.
Além da VM padrão, o Cloud Build oferece
vários tipos de VM de alta CPU
para executar builds. Para aumentar a velocidade do build, selecione uma máquina
com uma vCPU maior para executar builds. Lembre-se de que, embora a seleção de uma máquina com vCPU alta
aumente a velocidade do build, ela também pode aumentar o tempo de inicialização, já que
o Cloud Build só inicia máquinas não padrão sob demanda.
Se você precisar de mais opções de vCPU do que as fornecidas pelos pools padrão,
é possível executar os builds em pools privados,
que oferecem vários tipos de máquinas de alta CPU para builds.
Para saber mais sobre todos os tipos de máquina disponíveis, consulte a página de preços.
Antes de começar
Para usar os exemplos de linha de comando neste guia, instale e configure a
CLI do Google Cloud.
Se você já instalou a CLI gcloud, verifique se tem a
versão mais recente disponível executando gcloud components update.
Aumentar a vCPU para pools padrão
É possível aumentar a vCPU para executar builds em um pool padrão transmitindo
o valor diretamente para o comando gcloud builds submit ou especificando o
valor no arquivo de configuração do build.
Transmita o valor diretamente para o comando gcloud builds submit:
Para especificar um tamanho de VM personalizado diretamente no comando gcloud builds submit,
adicione o argumento --machine-type ao comando:
Atualize o campo machineType
para um valor de tipo enumerado correspondente a um dos tipos de máquina com suporte para pools padrão.
O exemplo a seguir mostra como adicionar a opção machineType a um
arquivo de configuração de build:
Atualize o campo machineType
para um valor de tipo enumerado correspondente a um dos tipos de máquina com suporte para pools padrão.
O exemplo a seguir mostra como adicionar a opção machineType a um
arquivo de configuração de build:
Selecione o projeto em que você criou o pool particular.
Clique no nome do pool particular.
No painel lateral Editar pool particular, use o menu suspenso Tipo de máquina para selecionar um tipo de máquina maior.
Clique em Salvar.
gcloud
É possível aumentar a vCPU para executar builds em um pool particular transmitindo
o valor diretamente para o comando gcloud builds worker-pools update ou
especificando o valor no arquivo de configuração do pool particular.
Especifique o valor no arquivo de configuração do pool particular:
Atualize o valor do campo machineType para um dos
tipos de máquina aceitos .
Execute o seguinte comando, em que PRIVATEPOOL_ID é
o identificador exclusivo do seu pool particular, REGION
é a região em que ele está localizado e PRIVATEPOOL_CONFIG_FILE
é o nome do arquivo de configuração do pool particular:
[[["Fácil de entender","easyToUnderstand","thumb-up"],["Meu problema foi resolvido","solvedMyProblem","thumb-up"],["Outro","otherUp","thumb-up"]],[["Difícil de entender","hardToUnderstand","thumb-down"],["Informações incorretas ou exemplo de código","incorrectInformationOrSampleCode","thumb-down"],["Não contém as informações/amostras de que eu preciso","missingTheInformationSamplesINeed","thumb-down"],["Problema na tradução","translationIssue","thumb-down"],["Outro","otherDown","thumb-down"]],["Última atualização 2025-08-18 UTC."],[[["\u003cp\u003eCloud Build allows you to increase the vCPU for your builds to enhance build speed by selecting a high-CPU virtual machine (VM).\u003c/p\u003e\n"],["\u003cp\u003eYou can increase vCPU for builds in default pools by using the \u003ccode\u003egcloud builds submit\u003c/code\u003e command with the \u003ccode\u003e--machine-type\u003c/code\u003e argument or by specifying the \u003ccode\u003emachineType\u003c/code\u003e field in the build config file.\u003c/p\u003e\n"],["\u003cp\u003eTo increase vCPU in private pools, you can use the \u003ccode\u003egcloud builds worker-pools update\u003c/code\u003e command or update the \u003ccode\u003emachineType\u003c/code\u003e field in the private pool config file.\u003c/p\u003e\n"],["\u003cp\u003eSelecting a high-vCPU machine can reduce build time, but may increase build startup time since non-standard machines are started on demand by Cloud Build.\u003c/p\u003e\n"],["\u003cp\u003eThe specific vCPU options available for both default and private pools can be found in the Cloud Build pricing page and the private pool configuration file schema, respectively.\u003c/p\u003e\n"]]],[],null,["# Increase vCPU for builds\n\nThis page describes how you can increase vCPU for your builds.\n\nBy default, Cloud Build runs your builds on a standard virtual machine (VM).\nIn addition to the standard VM, Cloud Build provides\n[several high-CPU VM types](/build/docs/api/reference/rest/v1/projects.builds#machinetype)\nto run builds. To increase the speed of your build, select a machine\nwith a higher vCPU to run builds. Keep in mind that although selecting a high vCPU machine\nincreases your build speed, it may also increase the startup time of your build as\nCloud Build only starts non-standard machines on demand.\n\nIf you require more vCPU options than the ones provided by default pools,\nyou can choose to run your builds on [private pools](/build/docs/private-pools/private-pools-overview),\nwhich provides a number of high-CPU machine types for builds.\n\nTo learn more about the all the available machine types, see the [Pricing page](/build/pricing).\n\nBefore you begin\n----------------\n\nTo use the command-line examples in this guide, install and configure the\n[Google Cloud CLI](/sdk/docs/install-sdk).\n\n- If you've installed gcloud CLI previously, make sure you have the latest available version by running `gcloud components update`.\n\nIncrease vCPU for default pools\n-------------------------------\n\nYou can increase the vCPU for running builds in a default pool either by passing\nthe value directly to the `gcloud builds submit` command or by specifying the\nvalue in the build config file.\n\n**Pass the value directly to the `gcloud builds submit` command:**\n\nTo specify a custom VM size directly in the `gcloud builds submit` command,\nadd the `--machine-type` argument to the command: \n\n gcloud builds submit --config=cloudbuild.yaml \\\n --machine-type=E2_HIGHCPU_8\n\n**Specify the value in the build config file:** \n\n### YAML\n\n1. Open your [build config file](/build/docs/build-config-file-schema).\n\n2. Update the [`machineType`](/build/docs/api/reference/rest/v1/projects.builds#machinetype)\n field to an enum value corresponding to one of the [supported machine types for default pools](/build/pricing).\n The following example shows how to add the `machineType` option to a\n build config file:\n\n steps:\n - name: 'gcr.io/cloud-builders/docker'\n args: ['build', '-t', 'gcr.io/my-project/image1', '.']\n options:\n machineType: 'E2_HIGHCPU_8'\n\n3. Start the build using the [gcloud CLI](/build/docs/running-builds/start-build-manually)\n or [build triggers](/build/docs/automating-builds/create-manage-triggers).\n\n### JSON\n\n1. Open your [build config file](/build/docs/build-config-file-schema).\n\n2. Update the [`machineType`](/build/docs/api/reference/rest/v1/projects.builds#machinetype)\n field to an enum value corresponding to one of the [supported machine types for default pools](/build/pricing).\n The following example shows how to add the `machineType` option to a\n build config file:\n\n {\n \"steps\": [\n {\n \"name\": \"gcr.io/cloud-builders/docker\",\n \"args\": [\"build\", \"-t\", \"gcr.io/my-project/image1\", \".\"]\n },\n \"options\": {\n \"machineType\": \"E2_HIGHCPU_8\"\n }\n }\n\n3. Start the build using the [gcloud CLI](/build/docs/running-builds/start-build-manually)\n or [build triggers](/build/docs/automating-builds/create-manage-triggers).\n\nIncrease vCPU for private pools\n-------------------------------\n\n### Console\n\n1. Open the **Worker pool** page in the Google Cloud console:\n\n [Open the Cloud Build worker pool page](https://console.cloud.google.com/cloud-build/settings/worker-pool)\n2. Select the project in which you created the private pool.\n\n3. Click on the private pool name.\n\n4. In the **Edit private pool** side panel, use the **Machine type** drop-down\n to select a larger machine type.\n\n5. Click **Save**.\n\n### gcloud\n\nYou can increase the vCPU for running builds in a private pool either by passing\nthe value directly to the `gcloud builds worker-pools update` command or by\nspecifying the value in the private pool config file.\n\n**Specify the value in the private pool config file:**\n\n1. Open your [private pool config\n file](/build/docs/private-pools/worker-pool-config-file-schema).\n\n2. Update the value of `machineType` field to one of the supported\n [machine types](/build/docs/private-pools/private-pool-config-file-schema#machinetype) .\n\n3. Run the following command, where \u003cvar translate=\"no\"\u003ePRIVATEPOOL_ID\u003c/var\u003e is\n the unique identifier for your private pool, \u003cvar translate=\"no\"\u003eREGION\u003c/var\u003e\n is the region where your private pool is located, and \u003cvar translate=\"no\"\u003ePRIVATEPOOL_CONFIG_FILE\u003c/var\u003e\n is the name of your private pool config file:\n\n gcloud builds worker-pools update \u003cvar translate=\"no\"\u003e\u003cspan class=\"devsite-syntax-n\"\u003ePRIVATEPOOL_ID\u003c/span\u003e\u003c/var\u003e \\\n --region=\u003cvar translate=\"no\"\u003e\u003cspan class=\"devsite-syntax-n\"\u003eREGION\u003c/span\u003e\u003c/var\u003e \\\n --config-from-file=\u003cvar translate=\"no\"\u003e\u003cspan class=\"devsite-syntax-n\"\u003ePRIVATEPOOL_CONFIG_FILE\u003c/span\u003e\u003c/var\u003e\n\n**Pass the value directly to the `gcloud builds worker-pools update` command:** \n\n gcloud builds worker-pools update \u003cvar translate=\"no\"\u003e\u003cspan class=\"devsite-syntax-nx\"\u003ePRIVATEPOOL_ID\u003c/span\u003e\u003c/var\u003e \\\n --region=\u003cvar translate=\"no\"\u003e\u003cspan class=\"devsite-syntax-nx\"\u003eREGION\u003c/span\u003e\u003c/var\u003e \\\n --worker-machine-type=\u003cvar translate=\"no\"\u003e\u003cspan class=\"devsite-syntax-nx\"\u003ePRIVATEPOOL_MACHINE_TYPE\u003c/span\u003e\u003c/var\u003e\n\nReplace the placeholder values in the above commands with the following:\n\n- \u003cvar translate=\"no\"\u003ePRIVATEPOOL_ID\u003c/var\u003e: the ID of your existing private pool. You cannot update this value; you must specify an existing private pool ID.\n- \u003cvar translate=\"no\"\u003eREGION\u003c/var\u003e: the [region](/build/docs/locations) where you created your private pool.\n- \u003cvar translate=\"no\"\u003ePRIVATEPOOL_DISK_SIZE\u003c/var\u003e: the updated disk size.\n- \u003cvar translate=\"no\"\u003ePRIVATEPOOL_MACHINE_TYPE\u003c/var\u003e is the updated machine type.\n\n Cloud Build uses the updated machine type anytime you run builds\n using corresponding private pool.\n\nWhat's next\n-----------\n\n- Learn about more best practices to [speed up builds](/build/docs/optimize-builds/speeding-up-builds)."]]