Enable blk_mq on Redhat (OEL/Centos) 7 and 8
The IO scheduler blk_mq was designed to increase disk performance – better IOps and lower latency – on flash disk systems, with emphasis on NVME devices. A nice by-product, is that it increases performance on the “older” SCSI/SAS/SATA layer as well, when the disks in the back are SSD, and even when they are rotational disks, in some cases.
When attempting to increase system disk performance (where and when this is the bottleneck, such as in the case of databases), this is a valid and relevant configuration option. If you have a baseline performance metrics to compare to – great ; But even if you do not have other, previous performance details – in most cases – for a modern system – your performance will improve after this change.
NVME devices get this scheduler enabled by default, so no worry there. However, your system might not be aware of the backend storage type of devices, nor of the backend capabilities when dealing with SCSI subsystem, so – by default – these settings are not enabled.
To enable these settings on RHEL/OEL/Centos version 7 and 8, you should do the following:
Edit /etc/default/grub and append to your GRUB_CMDLINE_LINUX the following string:
scsi_mod.use_blk_mq=1 dm_mod.use_blk_mq=y
This will enable blk_mq both on the SCSI subsystem, and the device mapper (DM), which includes software RAID, LVM and device-mapper-multipath (aka – multipath).
Following this, run:
grub2-mkconfig -o /boot/grub2/grub.cfg # for legacy BIOS
or
grub2-mkconfig -o /boot/efi/EFI/redhat/grub.cfg # for EFI
Of course – a reboot is required for these changes to take effect. Following the reboot, you will be able to see that the contents of /sys/block/sda/queue/scheduler (for /dev/sda, in my example. Check your relevant disks, of course) shows “[mq-deadline]”
If you want to read more about blk_mq – you can find it in great detail in this blog post.