Organiza tus páginas con colecciones
Guarda y categoriza el contenido según tus preferencias.
Linux
En el gráfico de rendimiento por tipo de disco, se describe el rendimiento máximo que se puede lograr para las particiones de SSD locales. Para optimizar las apps y las instancias de VM a fin de alcanzar estas velocidades, usa las siguientes prácticas recomendadas:
Usa optimizaciones del entorno de invitado para las SSD locales
De forma predeterminada, la mayoría de las imágenes de Linux que proporciona Compute Engine ejecutan automáticamente una secuencia de comandos de optimización que configura la instancia para el rendimiento máximo del SSD local. La secuencia de comandos habilita ciertas opciones de configuración de la cola sysfs que mejoran el rendimiento general de la máquina y enmascaran solicitudes de interrupción (IRQ) a CPUs virtuales específicas. Esta secuencia de comandos solo optimiza el rendimiento de las particiones de SSD locales de Compute Engine.
Puede que Ubuntu, SLES y otras imágenes más antiguas no estén configuradas para incluir esta optimización de rendimiento. Si usas alguna de estas imágenes o una imagen anterior a la versión v20141218, puedes instalar el entorno de invitado para habilitar estas optimizaciones.
Elige una interfaz para conectar las SSD locales
Puedes conectar SSD locales a tus VM mediante la interfaz NVMe o la interfaz SCSI. La mejor opción depende del sistema operativo (SO) que uses. Para la mayoría de los parámetros de configuración de carga de trabajo que involucran SSD locales, el uso de la interfaz NVMe mejora el rendimiento.
Si necesitas usar un SO específico, elige una interfaz para las particiones de SSD locales que funcione mejor con la imagen de disco de arranque.
Si tienes una configuración existente que requiere el uso de una interfaz SCSI, usa una imagen que admita SCSI de varias colas para lograr un mejor rendimiento en la interfaz SCSI estándar.
Habilita una SCSI de varias colas
Algunas imágenes públicas admiten SCSI de varias colas. Para usar una SCSI de varias colas en imágenes personalizadas que importes a tu proyecto, debes habilitarla tú mismo. Tus imágenes de Linux importadas pueden usar una SCSI de varias colas solo si incluyen la versión de kernel 3.19 o una posterior.
Para habilitar una SCSI de múltiples colas en una imagen personalizada, importa la imagen con la característica VIRTIO_SCSI_MULTIQUEUE del SO invitado habilitada y agrega una entrada a tu configuración de GRUB:
CentOS
Solo para CentOS7.
Importa tu imagen personalizada con la API y, luego, incluye un elemento guestOsFeatures con un valor type de VIRTIO_SCSI_MULTIQUEUE.
Verifica el valor del archivo /sys/module/scsi_mod/parameters/use_blk_mq.
$ cat /sys/module/scsi_mod/parameters/use_blk_mq
Si el valor de este archivo es Y, entonces la SCSI de múltiples colas ya está habilitada en tu imagen importada. Si el valor del archivo es N, incluye scsi_mod.use_blk_mq=Y en la entrada GRUB_CMDLINE_LINUX de tu archivo de configuración GRUB y reinicia el sistema.
Abre el archivo de configuración GRUB /etc/default/grub en un editor de texto.
$ sudo vi /etc/default/grub
Agrega scsi_mod.use_blk_mq=Y a la entrada GRUB_CMDLINE_LINUX.
Ejecuta el comando grub2-mkconfig para regenerar el archivo GRUB y completar la configuración.
$ sudo grub2-mkconfig -o /boot/grub2/grub.cfg
Reinicia la instancia.
$ sudo reboot
Ubuntu
Importa tu imagen personalizada con la API de Compute Engine y, luego, incluye un elemento guestOsFeatures con un valor type de VIRTIO_SCSI_MULTIQUEUE.
Verifica el valor del archivo /sys/module/scsi_mod/parameters/use_blk_mq.
$ cat /sys/module/scsi_mod/parameters/use_blk_mq
Si el valor de este archivo es Y, entonces la SCSI de múltiples colas ya está habilitada en tu imagen importada. Si el valor del archivo es N, incluye scsi_mod.use_blk_mq=Y en la entrada GRUB_CMDLINE_LINUX de tu archivo de configuración GRUB y reinicia el sistema.
Abre el archivo de configuración GRUB sudo nano /etc/default/grub en un editor de texto.
$ sudo nano /etc/default/grub
Agrega scsi_mod.use_blk_mq=Y a la entrada GRUB_CMDLINE_LINUX.
GRUB_CMDLINE_LINUX="scsi_mod.use_blk_mq=Y"
Guarda el archivo de configuración.
Ejecuta el comando update-grub para regenerar el archivo GRUB y completar la configuración.
[[["Fácil de comprender","easyToUnderstand","thumb-up"],["Resolvió mi problema","solvedMyProblem","thumb-up"],["Otro","otherUp","thumb-up"]],[["Difícil de entender","hardToUnderstand","thumb-down"],["Información o código de muestra incorrectos","incorrectInformationOrSampleCode","thumb-down"],["Faltan la información o los ejemplos que necesito","missingTheInformationSamplesINeed","thumb-down"],["Problema de traducción","translationIssue","thumb-down"],["Otro","otherDown","thumb-down"]],["Última actualización: 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)."]]