Mantenha tudo organizado com as coleções
Salve e categorize o conteúdo com base nas suas preferências.
Esta página descreve como pode aumentar a vCPU para as suas compilações.
Por predefinição, o Cloud Build executa as suas compilações numa máquina virtual (VM) padrão.
Além da VM padrão, o Cloud Build oferece
vários tipos de VMs com elevada capacidade de processamento
para executar compilações. Para aumentar a velocidade da compilação, selecione uma máquina com um número mais elevado de vCPUs para executar compilações. Tenha em atenção que, embora a seleção de uma máquina com um número elevado de vCPUs aumente a velocidade de compilação, também pode aumentar o tempo de arranque da compilação, uma vez que o Cloud Build só inicia máquinas não padrão a pedido.
Se precisar de mais opções de vCPU do que as fornecidas pelos conjuntos predefinidos,
pode optar por executar as suas compilações em conjuntos privados,
que oferecem vários tipos de máquinas com alta utilização de CPU para compilações.
Para saber mais sobre todos os tipos de máquinas disponíveis, consulte a página de preços.
Antes de começar
Para usar os exemplos de linhas de comando neste guia, instale e configure a
CLI do Google Cloud.
Se instalou a CLI gcloud anteriormente, certifique-se de que tem a versão mais recente disponível executando gcloud components update.
Aumente a vCPU para pools predefinidos
Pode aumentar a vCPU para executar compilações num conjunto predefinido transmitindo o valor diretamente para o comando gcloud builds submit ou especificando o valor no ficheiro de configuração de compilação.
Transmitir 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:
Selecione o projeto no qual criou o conjunto privado.
Clique no nome do conjunto privado.
No painel lateral Editar conjunto privado, use o menu pendente Tipo de máquina para selecionar um tipo de máquina maior.
Clique em Guardar.
gcloud
Pode aumentar a vCPU para executar compilações num conjunto privado transmitindo o valor diretamente para o comando gcloud builds worker-pools update ou especificando o valor no ficheiro de configuração do conjunto privado.
Especifique o valor no ficheiro de configuração do conjunto privado:
Atualize o valor do campo machineType para um dos tipos de máquinas compatíveis .
Execute o seguinte comando, em que PRIVATEPOOL_ID é
o identificador exclusivo do seu conjunto privado, REGION
é a região onde o seu conjunto privado está localizado e PRIVATEPOOL_CONFIG_FILE
é o nome do ficheiro de configuração do seu conjunto privado:
[[["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-21 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)."]]