Mantieni tutto organizzato con le raccolte
Salva e classifica i contenuti in base alle tue preferenze.
Linux
Il grafico delle prestazioni in base al tipo di disco
descrive le prestazioni massime ottenibili per le partizioni SSD locali. Per
ottimizzare le app e le istanze VM in modo da raggiungere queste velocità, utilizza le seguenti
best practice:
Utilizza le ottimizzazioni dell'ambiente guest per le unità SSD locali
Per impostazione predefinita, la maggior parte delle immagini Linux fornite da Compute Engine
esegue automaticamente uno script di ottimizzazione che configura l'istanza per le massime
prestazioni dell'unità SSD locale. Lo script attiva determinate
impostazioni della coda sysfs
che migliorano le prestazioni complessive della macchina e mascherano
le richieste di interruzione (IRQ)
per vCPU (CPU virtuali) specifiche. Questo script ottimizza le prestazioni solo per
le partizioni SSD locali di Compute Engine.
Ubuntu, SLES e altre immagini precedenti potrebbero non essere configurate per includere questa
ottimizzazione delle prestazioni. Se utilizzi una di queste immagini o un'immagine
precedente alla v20141218, puoi
installare l'ambiente guest
per attivare queste ottimizzazioni.
Scegli un'interfaccia per collegare le unità SSD locali
Puoi collegare le unità SSD locali alle tue VM utilizzando l'interfaccia NVMe o
l'interfaccia SCSI. La scelta migliore dipende dal sistema operativo (OS)
in uso. Per la maggior parte delle configurazioni dei workload che coinvolgono le unità SSD locali, l'utilizzo dell'interfaccia
NVMe consente di ottenere prestazioni migliori.
Se devi utilizzare un sistema operativo specifico, scegli un'interfaccia
per le partizioni dell'SSD locale che funzioni meglio con l'immagine disco di avvio.
Se hai già una configurazione che richiede l'utilizzo di un'interfaccia SCSI, utilizza
un'immagine che supporti SCSI multi-coda per ottenere prestazioni migliori
rispetto all'interfaccia SCSI standard.
Attiva l'SCSI multi-coda
Alcune immagini pubbliche supportano l'SCSI multi-coda. Per utilizzare l'SCSI con più code sulle immagini personalizzate
che importi nel tuo progetto, devi attivarlo autonomamente. Le
immagini Linux importate possono utilizzare SCSI multi-queue solo se includono la versione del kernel 3.19 o successiva.
Per attivare SCSI multi-coda su un'immagine personalizzata, importa l'immagine con la
funzionalità del sistema operativo guest VIRTIO_SCSI_MULTIQUEUE abilitata e aggiungi
una voce alla configurazione di GRUB:
CentOS
Solo per CentOS 7.
Importa l'immagine personalizzata utilizzando
l'API e includi un elemento guestOsFeatures con un
valore type pari a VIRTIO_SCSI_MULTIQUEUE.
Controlla il valore del file /sys/module/scsi_mod/parameters/use_blk_mq
$ cat /sys/module/scsi_mod/parameters/use_blk_mq
Se il valore di questo file è Y, significa che la funzionalità SCSI multi-coda è già
attivata sull'immagine importata. Se il valore del file è N,
include scsi_mod.use_blk_mq=Y nella voce GRUB_CMDLINE_LINUX
nel file di configurazione GRUB e riavvia il sistema.
Apri il file di configurazione GRUB
/etc/default/grub in un editor di testo.
$ sudo vi /etc/default/grub
Aggiungi scsi_mod.use_blk_mq=Y alla voce GRUB_CMDLINE_LINUX.
Esegui il comando grub2-mkconfig per rigenerare il file GRUB e
completare la configurazione.
$ sudo grub2-mkconfig -o /boot/grub2/grub.cfg
Riavvia l'istanza.
$ sudo reboot
Ubuntu
Importa l'immagine personalizzata utilizzando
l'API Compute Engine e includi un
elemento guestOsFeatures con un valore type pari a VIRTIO_SCSI_MULTIQUEUE.
Controlla il valore del file /sys/module/scsi_mod/parameters/use_blk_mq.
$ cat /sys/module/scsi_mod/parameters/use_blk_mq
Se il valore di questo file è Y, significa che la funzionalità SCSI multi-coda è gi
attivata sull'immagine importata. Se il valore del file è N,
include scsi_mod.use_blk_mq=Y nella voce GRUB_CMDLINE_LINUX
nel file di configurazione GRUB e riavvia il sistema.
Apri il file di configurazione GRUB
sudo nano /etc/default/grub in un editor di testo.
$ sudo nano /etc/default/grub
Aggiungi scsi_mod.use_blk_mq=Y alla voce GRUB_CMDLINE_LINUX.
GRUB_CMDLINE_LINUX="scsi_mod.use_blk_mq=Y"
Salvi il file di configurazione.
Esegui il comando update-grub per rigenerare il file GRUB e completare
la configurazione.
[[["Facile da capire","easyToUnderstand","thumb-up"],["Il problema è stato risolto","solvedMyProblem","thumb-up"],["Altra","otherUp","thumb-up"]],[["Difficile da capire","hardToUnderstand","thumb-down"],["Informazioni o codice di esempio errati","incorrectInformationOrSampleCode","thumb-down"],["Mancano le informazioni o gli esempi di cui ho bisogno","missingTheInformationSamplesINeed","thumb-down"],["Problema di traduzione","translationIssue","thumb-down"],["Altra","otherDown","thumb-down"]],["Ultimo aggiornamento 2025-07-01 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,["Linux\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\nUse 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\nChoose 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\nEnable 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\nCentOS\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\nUbuntu\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- [Benchmark your local SSDs](/compute/docs/disks/benchmarking-local-ssd-performance).\n- [Learn about local SSD pricing](/compute/disks-image-pricing#localssdpricing)."]]