Mit Sammlungen den Überblick behalten
Sie können Inhalte basierend auf Ihren Einstellungen speichern und kategorisieren.
Linux
In der nach Laufwerkstyp sortierten Leistungstabelle ist die maximal erreichbare Leistung lokaler SSD-Partitionen aufgeführt. Damit Ihre Anwendungen und VM-Instanzen diese Geschwindigkeiten erreichen, verwenden Sie die folgenden Best Practices:
Gastumgebung für lokale SSDs optimieren
Standardmäßig führen die meisten in Compute Engine bereitgestellten Linux-Images automatisch ein Optimierungsskript aus, das die Instanz für eine maximale Leistung der lokalen SSD konfiguriert. Das Skript aktiviert bestimmte sysfs-Einstellungen für Warteschlangen zur Verbesserung der Gesamtleistung der Maschine. Außerdem maskiert es Interrupt-Anfragen (IRQs) an bestimmte virtuelle CPUs (vCPUs). Dieses Skript optimiert nur die Leistung für lokale Compute Engine-SSD-Partitionen.
Ubuntu-, SLES- und andere frühere Images können möglicherweise nicht für diese Leistungsoptimierung konfiguriert werden. Wenn Sie eines dieser Images oder ein älteres Image als v20141218 verwenden, können Sie stattdessen die Gastumgebung installieren, um diese Optimierungen zu aktivieren.
Wählen Sie eine Schnittstelle zur Verbindung Ihrer lokalen SSDs aus
Sie können lokale SSDs über die NVMe-Schnittstelle oder die SCSI-Schnittstelle mit Ihren VMs verbinden. Die beste Wahl hängt vom verwendeten Betriebssystem ab. Bei den meisten Arbeitslastkonfigurationen mit lokalen SSDs führt die Verwendung der NVMe-Schnittstelle zu einer besseren Leistung.
Wenn Sie ein bestimmtes Betriebssystem verwenden müssen, wählen Sie eine Schnittstelle für Ihre lokalen SSD-Partitionen aus, die am besten zu Ihrem Bootlaufwerk-Image passt.
Wenn Sie bereits eine Einrichtung haben, die eine SCSI-Schnittstelle erfordert, verwenden Sie ein Image, das Multi-Queue-SCSI unterstützt. Damit erzielen Sie eine bessere Leistung als die Standard-SCSI-Schnittstelle.
Multi-Queue-SCSI aktivieren
Einige öffentliche Images unterstützen Multi-Queue-SCSI. Wenn Sie Multi-Queue-SCSI für benutzerdefinierte Images verwenden möchten, die Sie in Ihr Projekt importieren, müssen Sie die Funktion selbst aktivieren. Importierte Linux-Images unterstützen Multi-Queue-SCSI ab Kernel-Version 3.19.
Wenn Sie Multi-Queue-SCSI für ein benutzerdefiniertes Image aktivieren möchten, importieren Sie das Image mit aktivierter Gastbetriebssystemfunktion VIRTIO_SCSI_MULTIQUEUE. Fügen Sie dabei der GRUB-Konfiguration einen Eintrag hinzu:
CentOS
Nur für CentOS7
Importieren Sie Ihr benutzerdefiniertes Image mit der API. Beziehen Sie dabei das Element guestOsFeaturesmit dem type-Wert VIRTIO_SCSI_MULTIQUEUE ein.
Prüfen Sie den Wert der Datei /sys/module/scsi_mod/parameters/use_blk_mq.
$ cat /sys/module/scsi_mod/parameters/use_blk_mq
Wenn der Wert dieser Datei Y ist, ist das Multi-Queue-SCSI bereits auf Ihrem importierten Image aktiviert. Ist der Wert der Datei N, fügen Sie scsi_mod.use_blk_mq=Y in den Eintrag GRUB_CMDLINE_LINUX der GRUB-Konfigurationsdatei ein und starten Sie dann das System neu.
Öffnen Sie die GRUB-Konfigurationsdatei /etc/default/grub in einem Texteditor.
$ sudo vi /etc/default/grub
Fügen Sie scsi_mod.use_blk_mq=Y zum Eintrag GRUB_CMDLINE_LINUX hinzu.
Führen Sie den Befehl grub2-mkconfig aus, um die GRUB-Datei neu zu generieren und die Konfiguration abzuschließen.
$ sudo grub2-mkconfig -o /boot/grub2/grub.cfg
Starten Sie die Instanz neu.
$ sudo reboot
Ubuntu
Importieren Sie das benutzerdefinierte Image mit der Compute Engine API und schließen Sie ein guestOsFeatures-Element mit dem type-Wert VIRTIO_SCSI_MULTIQUEUE ein.
Prüfen Sie den Wert der Datei /sys/module/scsi_mod/parameters/use_blk_mq.
$ cat /sys/module/scsi_mod/parameters/use_blk_mq
Wenn der Wert dieser Datei Y ist, ist das Multi-Queue-SCSI bereits auf Ihrem importierten Image aktiviert. Ist der Wert der Datei N, fügen Sie scsi_mod.use_blk_mq=Y in den Eintrag GRUB_CMDLINE_LINUX der GRUB-Konfigurationsdatei ein und starten Sie dann das System neu.
Öffnen Sie die GRUB-Konfigurationsdatei sudo nano /etc/default/grub in einem Texteditor.
$ sudo nano /etc/default/grub
Fügen Sie scsi_mod.use_blk_mq=Y zum Eintrag GRUB_CMDLINE_LINUX hinzu.
GRUB_CMDLINE_LINUX="scsi_mod.use_blk_mq=Y"
Speichern Sie die Konfigurationsdatei.
Führen Sie den Befehl update-grub aus, um die GRUB-Datei neu zu generieren und die Konfiguration abzuschließen.
[[["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-03-27 (UTC)."],[[["\u003cp\u003eCompute Engine-provided Linux images automatically optimize for peak Local SSD performance by enabling specific queue \u003ccode\u003esysfs\u003c/code\u003e settings and masking interrupt requests (IRQs) to virtual CPUs (vCPUs).\u003c/p\u003e\n"],["\u003cp\u003eFor optimal performance with Local SSDs, the NVMe interface is generally recommended, although the SCSI interface is an option, especially when compatibility is a concern, or when using older machine series.\u003c/p\u003e\n"],["\u003cp\u003eWhen using the SCSI interface, enabling multi-queue SCSI on your custom images, which requires kernel version 3.19 or later, can significantly enhance performance over standard SCSI.\u003c/p\u003e\n"],["\u003cp\u003eTo enable multi-queue SCSI on a custom Linux image, the image must be imported with the \u003ccode\u003eVIRTIO_SCSI_MULTIQUEUE\u003c/code\u003e guest OS feature enabled, and the \u003ccode\u003escsi_mod.use_blk_mq=Y\u003c/code\u003e parameter must be included in the GRUB config.\u003c/p\u003e\n"]]],[],null,["# Optimizing local SSD performance\n\nLinux\n\n*** ** * ** ***\n\nThe [performance by disk type chart](/compute/docs/disks/local-ssd#performance)\ndescribes the maximum achievable performance for local SSD partitions. To\noptimize your apps and VM instances to achieve these speeds, use the following\nbest practices:\n\n### Use guest environment optimizations for Local SSDs\n\nBy default, most Compute Engine-provided Linux images\nautomatically run an optimization script that configures the instance for peak\nLocal SSD performance. The script enables certain\n[queue `sysfs` settings](https://www.kernel.org/doc/Documentation/block/queue-sysfs.rst)\nthat enhance the overall performance of your machine and mask\n[interrupt requests (IRQs)](https://en.wikipedia.org/wiki/Interrupt_request)\nto specific virtual CPUs (vCPUs). This script only optimizes performance for\nCompute Engine local SSD partitions.\n\nUbuntu, SLES, and other earlier images might not be configured to include this\nperformance optimization. If you are using any of these images or an image\nthat is earlier than **v20141218** , you can\n[install the guest environment](/compute/docs/images/install-guest-environment)\nto enable these optimizations.\n\n### Choose an interface to connect your local SSDs\n\nYou can connect Local SSDs to your VMs using either the NVMe interface or\nthe SCSI interface. The best choice depends on the operating system (OS) you are\nusing. For most workload configurations involving Local SSDs, using the NVMe\ninterface leads to better performance.\n| **Note:** Newer machine series (third generation) support only the NVMe disk interface.\n\n- **If you need to use a specific OS** , [choose an interface](/compute/docs/disks/local-ssd#choose_an_interface)\n for your local SSD partitions that works best with your boot disk image.\n\n- **If you have an existing setup that requires using a SCSI interface** , use an\n image that supports [multi-queue SCSI](#multiqueue) to achieve better\n performance over the standard SCSI interface.\n\n### Enable multi-queue SCSI\n\nSome public images support multi-queue SCSI. To use multi-queue SCSI on custom\nimages that you import to your project, you must enable it yourself. Your\nimported Linux images can use multi-queue SCSI only if they include kernel\nversion `3.19` or later.\n\nTo enable multi-queue SCSI on a custom image, import the image with the\n`VIRTIO_SCSI_MULTIQUEUE` guest OS feature enabled and add\nan entry to your GRUB config: \n\n### CentOS\n\nFor CentOS7 only.\n\n1. Import your custom image using the\n [API](/compute/docs/reference/latest/instances) and include a\n `guestOsFeatures` item with a `type` value of `VIRTIO_SCSI_MULTIQUEUE`.\n\n2. Create an instance using your custom image and\n [attach one or more local SSDs](/compute/docs/disks/add-local-ssd#create_local_ssd).\n\n3. [Connect to your instance](/compute/docs/instances/connecting-to-instance)\n through SSH.\n\n4. Check the value of the `/sys/module/scsi_mod/parameters/use_blk_mq` file\n\n ```\n $ cat /sys/module/scsi_mod/parameters/use_blk_mq\n ```\n\n If the value of this file is `Y`, then multi-queue SCSI is already\n enabled on your imported image. If the value of the file is `N`,\n include `scsi_mod.use_blk_mq=Y` in the `GRUB_CMDLINE_LINUX` entry\n in your GRUB config file and restart the system.\n 1. Open the `/etc/default/grub` GRUB config file\n in a text editor.\n\n ```\n $ sudo vi /etc/default/grub\n ```\n 2. Add `scsi_mod.use_blk_mq=Y` to the `GRUB_CMDLINE_LINUX` entry.\n\n GRUB_CMDLINE_LINUX=\" vconsole.keymap=us console=ttyS0,38400n8 vconsole.font=latarcyrheb-sun16 scsi_mod.use_blk_mq=Y\"\n\n 3. Save the config file.\n\n 4. Run the `grub2-mkconfig` command to regenerate the GRUB file and\n complete the configuration.\n\n ```\n $ sudo grub2-mkconfig -o /boot/grub2/grub.cfg\n ```\n 5. Reboot the instance.\n\n ```\n $ sudo reboot\n ```\n\n### Ubuntu\n\n1. Import your custom image using the\n [Compute Engine API](/compute/docs/reference/latest/instances)\n and include a\n `guestOsFeatures` item with a `type` value of `VIRTIO_SCSI_MULTIQUEUE`.\n\n2. Create an instance using your custom image and\n [attach one or more local SSDs](/compute/docs/disks/local-ssd#create_local_ssd)\n using the SCSI interface.\n\n3. [Connect to your instance](/compute/docs/instances/connecting-to-instance)\n through SSH.\n\n4. Check the value of the `/sys/module/scsi_mod/parameters/use_blk_mq` file.\n\n ```\n $ cat /sys/module/scsi_mod/parameters/use_blk_mq\n ```\n\n If the value of this file is `Y`, then multi-queue SCSI is already\n enabled on your imported image. If the value of the file is `N`,\n include `scsi_mod.use_blk_mq=Y` in the `GRUB_CMDLINE_LINUX` entry\n in your GRUB config file and restart the system.\n 1. Open the `sudo nano /etc/default/grub` GRUB config file\n in a text editor.\n\n ```\n $ sudo nano /etc/default/grub\n ```\n 2. Add `scsi_mod.use_blk_mq=Y` to the `GRUB_CMDLINE_LINUX` entry.\n\n GRUB_CMDLINE_LINUX=\"scsi_mod.use_blk_mq=Y\"\n\n 3. Save the config file.\n\n 4. Run the `update-grub` command to regenerate the GRUB file and complete\n the configuration.\n\n ```\n $ sudo update-grub\n ```\n 5. Reboot the instance.\n\n ```\n $ sudo reboot\n ```\n\nWhat's next\n-----------\n\n- [Benchmark your local SSDs](/compute/docs/disks/benchmarking-local-ssd-performance).\n- [Learn about local SSD pricing](/compute/disks-image-pricing#localssdpricing)."]]