Optimizing local SSD performance

Linux

Theperformance by disk type chartdescribes the maximum achievable performance for local SSD partitions. Tooptimize your apps and VM instances to achieve these speeds, use the followingbest practices:

Use guest environment optimizations for Local SSDs

By default, most Compute Engine-provided Linux imagesautomatically run an optimization script that configures the instance for peakLocal SSD performance. The script enables certainqueuesysfs settingsthat enhance the overall performance of your machine and maskinterrupt requests (IRQs)to specific virtual CPUs (vCPUs). This script only optimizes performance forCompute Engine local SSD partitions.

Ubuntu, SLES, and other earlier images might not be configured to include thisperformance optimization. If you are using any of these images or an imagethat is earlier thanv20141218, you caninstall the guest environmentto enable these optimizations.

Choose an interface to connect your local SSDs

You can connect Local SSDs to your VMs using either the NVMe interface orthe SCSI interface. The best choice depends on the operating system (OS) you areusing. For most workload configurations involving Local SSDs, using the NVMeinterface leads to better performance.

Note: Newer machine series (third generation) support only the NVMe diskinterface.

Enable multi-queue SCSI

Some public images support multi-queue SCSI. To use multi-queue SCSI on customimages that you import to your project, you must enable it yourself. Yourimported Linux images can use multi-queue SCSI only if they include kernelversion3.19 or later.

To enable multi-queue SCSI on a custom image, import the image with theVIRTIO_SCSI_MULTIQUEUE guest OS feature enabled and addan entry to your GRUB config:

CentOS

For CentOS7 only.

  1. Import your custom image using theAPI and include aguestOsFeatures item with atype value ofVIRTIO_SCSI_MULTIQUEUE.

  2. Create an instance using your custom image andattach one or more local SSDs.

  3. Connect to your instancethrough SSH.

  4. Check the value of the/sys/module/scsi_mod/parameters/use_blk_mq file

    $cat /sys/module/scsi_mod/parameters/use_blk_mq

    If the value of this file isY, then multi-queue SCSI is alreadyenabled on your imported image. If the value of the file isN,includescsi_mod.use_blk_mq=Y in theGRUB_CMDLINE_LINUX entryin your GRUB config file and restart the system.

    1. Open the/etc/default/grub GRUB config filein a text editor.

      $sudo vi /etc/default/grub
    2. Addscsi_mod.use_blk_mq=Y to theGRUB_CMDLINE_LINUX entry.

      GRUB_CMDLINE_LINUX=" vconsole.keymap=us console=ttyS0,38400n8 vconsole.font=latarcyrheb-sun16 scsi_mod.use_blk_mq=Y"
    3. Save the config file.

    4. Run thegrub2-mkconfig command to regenerate the GRUB file andcomplete the configuration.

      $sudo grub2-mkconfig -o /boot/grub2/grub.cfg
    5. Reboot the instance.

      $sudo reboot

Ubuntu

  1. Import your custom image using theCompute Engine APIand include aguestOsFeatures item with atype value ofVIRTIO_SCSI_MULTIQUEUE.

  2. Create an instance using your custom image andattach one or more local SSDsusing the SCSI interface.

  3. Connect to your instancethrough SSH.

  4. Check the value of the/sys/module/scsi_mod/parameters/use_blk_mq file.

    $cat /sys/module/scsi_mod/parameters/use_blk_mq

    If the value of this file isY, then multi-queue SCSI is alreadyenabled on your imported image. If the value of the file isN,includescsi_mod.use_blk_mq=Y in theGRUB_CMDLINE_LINUX entryin your GRUB config file and restart the system.

    1. Open thesudo nano /etc/default/grub GRUB config filein a text editor.

      $sudo nano /etc/default/grub
    2. Addscsi_mod.use_blk_mq=Y to theGRUB_CMDLINE_LINUX entry.

      GRUB_CMDLINE_LINUX="scsi_mod.use_blk_mq=Y"
    3. Save the config file.

    4. Run theupdate-grub command to regenerate the GRUB file and completethe configuration.

      $sudo update-grub
    5. Reboot the instance.

      $sudo reboot

What's next

Except as otherwise noted, the content of this page is licensed under theCreative Commons Attribution 4.0 License, and code samples are licensed under theApache 2.0 License. For details, see theGoogle Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.

Last updated 2025-10-24 UTC.