Mit Sammlungen den Überblick behalten
Sie können Inhalte basierend auf Ihren Einstellungen speichern und kategorisieren.
Linux
Windows
In diesem Dokument wird beschrieben, wie Sie die Anzahl der sichtbaren CPU-Kerne für eine VM-Instanz aufrufen.
Wenn Sie die Details einer VM aufrufen, können Sie prüfen, ob die VM die Standardanzahl der sichtbaren CPU-Kerne hat oder ob diese Anzahl angepasst wurde. Wenn Sie die Anzahl der sichtbaren CPU-Kerne für eine VM reduzieren, können Sie die Lizenzkosten senken, ohne die Leistungsgrenzen für Persistent Disks zu verringern.
Wenn Sie die Anzahl der sichtbaren CPU-Kerne reduzieren, kann sich dies jedoch auf die Netzwerkleistung auswirken.
Hinweise
Richten Sie die Authentifizierung ein, falls Sie dies noch nicht getan haben.
Bei der Authentifizierung wird Ihre Identität für den Zugriff auf Google Cloud -Dienste und APIs überprüft.
Zum Ausführen von Code oder Beispielen aus einer lokalen Entwicklungsumgebung können Sie sich so bei der Compute Engine authentifizieren:
Select the tab for how you plan to use the samples on this page:
Console
When you use the Google Cloud console to access Google Cloud services and
APIs, you don't need to set up authentication.
gcloud
Installieren Sie die Google Cloud CLI.
Initialisieren Sie die Google Cloud CLI nach der Installation mit dem folgenden Befehl:
Wenn Sie die REST API-Beispiele auf dieser Seite in einer lokalen Entwicklungsumgebung verwenden möchten, verwenden Sie die Anmeldedaten, die Sie der gcloud CLI bereitstellen.
Installieren Sie die Google Cloud CLI.
Initialisieren Sie die Google Cloud CLI nach der Installation mit dem folgenden Befehl:
Klicken Sie in der Spalte Name auf den Namen der VM.
Die Detailseite der VM wird geöffnet und der Tab Details ist ausgewählt.
Prüfen Sie im Abschnitt Maschinenkonfiguration den Wert für Benutzerdefinierte sichtbare Kerne. Wenn kein Wert angezeigt wird, hat die VM die Standardanzahl der sichtbaren CPU-Kerne.
[[["Leicht verständlich","easyToUnderstand","thumb-up"],["Mein Problem wurde gelöst","solvedMyProblem","thumb-up"],["Sonstiges","otherUp","thumb-up"]],[["Schwer verständlich","hardToUnderstand","thumb-down"],["Informationen oder Beispielcode falsch","incorrectInformationOrSampleCode","thumb-down"],["Benötigte Informationen/Beispiele nicht gefunden","missingTheInformationSamplesINeed","thumb-down"],["Problem mit der Übersetzung","translationIssue","thumb-down"],["Sonstiges","otherDown","thumb-down"]],["Zuletzt aktualisiert: 2025-08-18 (UTC)."],[[["\u003cp\u003eThis document provides instructions on how to check if a virtual machine (VM) has the default number of visible CPU cores or if it has been customized.\u003c/p\u003e\n"],["\u003cp\u003eReducing the number of visible CPU cores can help decrease licensing costs, but it might impact network performance and overall VM performance.\u003c/p\u003e\n"],["\u003cp\u003eYou can view the number of visible CPU cores through the Google Cloud console, by using the \u003ccode\u003egcloud compute instances describe\u003c/code\u003e command, or by making a \u003ccode\u003eGET\u003c/code\u003e request to the \u003ccode\u003einstances.get\u003c/code\u003e method.\u003c/p\u003e\n"],["\u003cp\u003eIf the \u003ccode\u003evisibleCoreCount\u003c/code\u003e field is present in the output, the VM has a customized number of visible CPU cores; otherwise, it has the default number.\u003c/p\u003e\n"],["\u003cp\u003eTo view the details of the VM, the required permission is \u003ccode\u003ecompute.instances.get\u003c/code\u003e, granted by the \u003ccode\u003eCompute Instance Admin (v1)\u003c/code\u003e role.\u003c/p\u003e\n"]]],[],null,["# View the number of visible CPU cores\n\nLinux Windows\n\n*** ** * ** ***\n\nThis document describes how to view the number of visible CPU cores for a\nvirtual machine (VM) instance.\n\nWhen you\n[view the details of a VM](/compute/docs/instances/view-vm-details), you\ncan verify if the VM has the default number of visible CPU cores, or if this\nnumber has been customized. Reducing the number of visible CPU cores for a VM\ncan help reduce licensing costs without reducing Persistent Disk performance limits.\nHowever, reducing the number of visible CPU cores might affect network\nperformance.\n| **Note:** Reducing the number of visible CPU cores for a VM might impact the performance of the VM. For more information, see [Performance considerations](/compute/docs/instances/customize-visible-cores#performance_considerations).\n\nBefore you begin\n----------------\n\n- If you haven't already, set up [authentication](/compute/docs/authentication). Authentication verifies your identity for access to Google Cloud services and APIs. To run code or samples from a local development environment, you can authenticate to Compute Engine by selecting one of the following options:\n\n Select the tab for how you plan to use the samples on this page: \n\n ### Console\n\n\n When you use the Google Cloud console to access Google Cloud services and\n APIs, you don't need to set up authentication.\n\n ### gcloud\n\n 1.\n [Install](/sdk/docs/install) the Google Cloud CLI.\n\n After installation,\n [initialize](/sdk/docs/initializing) the Google Cloud CLI by running the following command:\n\n ```bash\n gcloud init\n ```\n\n\n If you're using an external identity provider (IdP), you must first\n [sign in to the gcloud CLI with your federated identity](/iam/docs/workforce-log-in-gcloud).\n | **Note:** If you installed the gcloud CLI previously, make sure you have the latest version by running `gcloud components update`.\n 2. [Set a default region and zone](/compute/docs/gcloud-compute#set_default_zone_and_region_in_your_local_client).\n\n ### REST\n\n\n To use the REST API samples on this page in a local development environment, you use the\n credentials you provide to the gcloud CLI.\n 1. [Install](/sdk/docs/install) the Google Cloud CLI. After installation, [initialize](/sdk/docs/initializing) the Google Cloud CLI by running the following command: \n\n ```bash\n gcloud init\n ```\n 2. If you're using an external identity provider (IdP), you must first [sign in to the gcloud CLI with your federated identity](/iam/docs/workforce-log-in-gcloud).\n\n\n For more information, see\n [Authenticate for using REST](/docs/authentication/rest)\n in the Google Cloud authentication documentation.\n\n### Required roles\n\n\nTo get the permission that\nyou need to view the details of a VM,\n\nask your administrator to grant you the\n\n\n[Compute Instance Admin (v1)](/iam/docs/roles-permissions/compute#compute.instanceAdmin.v1) (`roles/compute.instanceAdmin.v1`)\nIAM role on the VM or project.\n\n\nFor more information about granting roles, see [Manage access to projects, folders, and organizations](/iam/docs/granting-changing-revoking-access).\n\n\nThis predefined role contains the\n` compute.instances.get`\npermission,\nwhich is required to\nview the details of a VM.\n\n\nYou might also be able to get\nthis permission\nwith [custom roles](/iam/docs/creating-custom-roles) or\nother [predefined roles](/iam/docs/roles-overview#predefined).\n\nView the number of visible CPU cores for a VM\n---------------------------------------------\n\nTo determine if the number of visible CPU cores was customized for a VM, select\none of the following options: \n\n### Console\n\n1. In the Google Cloud console, go to the **VM instances** page.\n\n [Go to VM instances](https://console.cloud.google.com/compute/instances)\n2. In the **Name** column, click the name of\n the VM.\n\n The details page of the VM opens and the **Details** tab is selected.\n3. In the **Machine configuration** section, check the value for\n **Custom visible cores** . If there is no value displayed, then the VM\n has the\n [default number of visible CPU cores](/compute/docs/instances/customize-visible-cores).\n\n### gcloud\n\nTo view the details of the VM, use the\n[`gcloud compute instances describe` command](/sdk/gcloud/reference/compute/instances/describe). \n\n gcloud compute instances describe \u003cvar translate=\"no\"\u003eVM_NAME\u003c/var\u003e \\\n --zone=\u003cvar translate=\"no\"\u003eZONE\u003c/var\u003e\n\nReplace the following:\n\n- \u003cvar translate=\"no\"\u003eVM_NAME\u003c/var\u003e: the name of the VM.\n\n- \u003cvar translate=\"no\"\u003eZONE\u003c/var\u003e: the zone where the VM is located.\n\nIf the number of visible CPU cores for the VM was customized, then\nthe output contains the `visibleCoreCount` field as follows: \n\n advancedMachineFeatures:\n visibleCoreCount: \u003cvar translate=\"no\"\u003eVISIBLE_CORE_COUNT\u003c/var\u003e\n ...\n\nIf the output doesn't contain the `visibleCoreCount` field, then\nthe VM has the\n[default number of visible CPU cores](/compute/docs/instances/customize-visible-cores).\n\n### REST\n\nTo view the details of the VM, make a `GET` request to the\n[`instances.get` method](/compute/docs/reference/rest/v1/instances/get). \n\n GET https://compute.googleapis.com/compute/v1/projects/\u003cvar translate=\"no\"\u003ePROJECT_ID\u003c/var\u003e/zones/\u003cvar translate=\"no\"\u003eZONE\u003c/var\u003e/instances/\u003cvar translate=\"no\"\u003eVM_NAME\u003c/var\u003e\n\nReplace the following:\n\n- \u003cvar translate=\"no\"\u003ePROJECT_ID\u003c/var\u003e: the ID of the project where the VM is\n located.\n\n- \u003cvar translate=\"no\"\u003eZONE\u003c/var\u003e: the zone where the VM is located.\n\n- \u003cvar translate=\"no\"\u003eVM_NAME\u003c/var\u003e: the name of the VM.\n\nIf the number of visible CPU cores for the VM was customized, then\nthe output contains the `visibleCoreCount` field as follows: \n\n {\n ...\n \"advancedMachineFeatures\": {\n visibleCoreCount: \u003cvar translate=\"no\"\u003eVISIBLE_CORE_COUNT\u003c/var\u003e\n },\n ...\n }\n\nIf the output doesn't contain the `visibleCoreCount` field, then\nthe VM has the\n[default number of visible CPU cores](/compute/docs/instances/customize-visible-cores).\n\nWhat's next\n-----------\n\n- [Customize the number of visible cores](/compute/docs/instances/customize-visible-cores)\n- [Set the number of threads per core](/compute/docs/instances/set-threads-per-core)"]]