Optimizing local SSD performance
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.If you need to use a specific OS,choose an interfacefor your local SSD partitions that works best with your boot disk image.
If you have an existing setup that requires using a SCSI interface, use animage that supportsmulti-queue SCSI to achieve betterperformance over the standard SCSI interface.
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.
Import your custom image using theAPI and include a
guestOsFeaturesitem with atypevalue ofVIRTIO_SCSI_MULTIQUEUE.Create an instance using your custom image andattach one or more local SSDs.
Connect to your instancethrough SSH.
Check the value of the
/sys/module/scsi_mod/parameters/use_blk_mqfile$cat /sys/module/scsi_mod/parameters/use_blk_mqIf the value of this file is
Y, then multi-queue SCSI is alreadyenabled on your imported image. If the value of the file isN,includescsi_mod.use_blk_mq=Yin theGRUB_CMDLINE_LINUXentryin your GRUB config file and restart the system.Open the
/etc/default/grubGRUB config filein a text editor.$sudo vi /etc/default/grubAdd
scsi_mod.use_blk_mq=Yto theGRUB_CMDLINE_LINUXentry.GRUB_CMDLINE_LINUX=" vconsole.keymap=us console=ttyS0,38400n8 vconsole.font=latarcyrheb-sun16 scsi_mod.use_blk_mq=Y"Save the config file.
Run the
grub2-mkconfigcommand to regenerate the GRUB file andcomplete the configuration.$sudo grub2-mkconfig -o /boot/grub2/grub.cfgReboot the instance.
$sudo reboot
Ubuntu
Import your custom image using theCompute Engine APIand include a
guestOsFeaturesitem with atypevalue ofVIRTIO_SCSI_MULTIQUEUE.Create an instance using your custom image andattach one or more local SSDsusing the SCSI interface.
Connect to your instancethrough SSH.
Check the value of the
/sys/module/scsi_mod/parameters/use_blk_mqfile.$cat /sys/module/scsi_mod/parameters/use_blk_mqIf the value of this file is
Y, then multi-queue SCSI is alreadyenabled on your imported image. If the value of the file isN,includescsi_mod.use_blk_mq=Yin theGRUB_CMDLINE_LINUXentryin your GRUB config file and restart the system.Open the
sudo nano /etc/default/grubGRUB config filein a text editor.$sudo nano /etc/default/grubAdd
scsi_mod.use_blk_mq=Yto theGRUB_CMDLINE_LINUXentry.GRUB_CMDLINE_LINUX="scsi_mod.use_blk_mq=Y"Save the config file.
Run the
update-grubcommand to regenerate the GRUB file and completethe configuration.$sudo update-grubReboot 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.