Description

Storage performance on Linux systems depends on many parameters and settings. One of them is Linux I/O scheduler which defines a way how to work and optimize disk access requests. There are several I/O scheduler options available that can be used depending on the storage type and environment. This article describes how to change Linux I/O scheduler in Linux-based VM with StarWind VSAN.

Solution

Before changing the I/O scheduler option, it is good to clarify them by reading the file /sys/block/<disk device>/queue/scheduler.
For example, the command below shows that I/O scheduler for disk sda is set to deadline.

# cat /sys/block/sda/queue/scheduler
noop [deadline] cfq


NOTE:
Depending on the kernel version, the output can also looks like: [bfq] mq-deadline none

Different schedulers can be used depending on environment requirements and disk types and must be chosen based on the tests, performed in a specific environment. However, it was defined that for SSD or NVME drives the none or noop I/O scheduler reduces CPU overhead, while for HDD storage the mq-deadline I/O scheduler shows better results with synthetic tests.

In order to change the I/O scheduler, the corresponding information has to be changed in /sys/block/<disk device>/queue/scheduler file. Please find below one of the possible ways how it can be done. In the example below I/O scheduler for disk sdb is set to noop:

# echo noop > /sys/block/sdb/queue/scheduler

After changing the file, please double-check that I/O scheduler has been changed:

# cat /sys/block/sdb/queue/scheduler
[noop] deadline cfq


NOTE
: It is important to remember that I/O scheduler in Linux is defined on each disk device separately, thus it makes sense to check it for each disk device, like sda, sdb, etc.

In order to apply the scheduler rules permanently, for example after Linux restart, the scheduler.rules file in /etc/udev/rules.d/ have to be edited and one more rule should be added.

For example, the following line will change I/O scheduler to noop for sdb device, and set no read ahead policy for it.

ACTION=="add|change", SUBSYSTEM=="block", KERNEL=="sdb", ATTR{queue/scheduler}="noop", ATTR{queue/read_ahead_kb}="0"

For the cases, when storage is used by StarWind VSAN service and HA device, in order to avoid performance issues, it’s highly recommended to set the same I/O scheduler settings for the storage on all nodes, where HA devices are located.

NOTE: In the latest StarWind VSAN for vSphere builds it is configured to identify storage type automatically and change I/O scheduler for SSD storage to noop.

More information about I/O schedulers in Linux:

IOSchedulers: https://wiki.ubuntu.com/Kernel/Reference/IOSchedulers

What is the suggested I/O scheduler to improve disk performance when using Red Hat Enterprise Linux with virtualization?: https://access.redhat.com/solutions/5427

Request a Product Feature

To request a new product feature or to provide feedback on a StarWind product, please email our support at support@starwind.com and put “Request a Product Feature” as the subject.

Back to Knowledge Base