IO Scheduler

From Proxmox VE
Revision as of 11:56, 6 February 2025 by F.ebner (talk | contribs) (Update article for current kernels)
Jump to navigation Jump to search

Introduction

The Linux kernel, the core of the operating system, is responsible for controlling disk access by using kernel IO scheduling.

This article explains how-to change the IO scheduler without recompiling the kernel and without restart.

Check the currently used IO scheduler

cat /sys/block/sda/queue/scheduler
[none] mq-deadline bfq

For example the scheduler mq-deadline delivers best performance on hardware raid and SAN environments. While none delivers better performance for SSDs.

If you don't see bfq as an option, it means that the kernel module is not loaded. It is still possible to configure the BFQ scheduler however, which will automatically load the kernel module. To load the module manually, use:

modprobe bfq

Switching IO Schedulers on runtime

Set the scheduler for /dev/sda to Multi-Queue Deadline:

echo mq-deadline > /sys/block/sda/queue/scheduler

Set the scheduler for /dev/sda to BFQ:

echo bfq > /sys/block/sda/queue/scheduler

Set IO Schedulers permanently

This can be done via udev rules. For a basic example, create /etc/udev/rules.d/60-io-scheduler.rules with content:

ACTION=="add|change", KERNEL=="sd[a-z]*", ATTR{queue/scheduler}="bfq"

Links