Using the Deadline IO Scheduler
Environment
- Red Hat Enterprise Linux 7
- Red Hat Enterprise Linux 6
- Red Hat Enterprise Linux 5
- Red Hat Enterprise Linux 4
Issue
- How do I turn on the deadline scheduler for a device?
- What are the tunables for the deadline scheduler and what do they do?
- How does the logic within the scheduler work in choosing which IO to dispatch next?
Resolution
To configure a disk to use the deadline scheduler:
- RHEL 5, RHEL 6, RHEL 7: via the
/sys
filesystem
$ echo 'deadline' > /sys/block/sda/queue/scheduler $ cat /sys/block/sda/queue/scheduler noop anticipatory [deadline] cfq
To configure all disks to use the deadline scheduler (at boot time):
- RHEL 4, RHEL 5, RHEL 6: add
elevator=deadline
to the end of the kernel line in/etc/grub.conf
file:
title Red Hat Enterprise Linux Server (2.6.9-67.EL) root (hd0,0) kernel /vmlinuz-2.6.9-67.EL ro root=/dev/vg0/lv0 elevator=deadline initrd /initrd-2.6.9-67.EL.img
- RHEL 7: add `elevator=deadline` to `GRUB_CMDLINE_LINUX` in `/etc/default/grub`
GRUB_TIMEOUT=5 GRUB_DISTRIBUTOR="$(sed 's, release .*$,,g' /etc/system-release)" GRUB_DEFAULT=saved GRUB_DISABLE_SUBMENU=true GRUB_TERMINAL_OUTPUT="console" GRUB_CMDLINE_LINUX="vconsole.font=latarcyrheb-sun16 vconsole.keymap=us rd.lvm.lv=vgroot/root elevator=deadline crashkernel=auto rhgb quiet" GRUB_DISABLE_RECOVERY="true"
- and then rebuild the `/boot/grub2/grub.cfg` file to reflect the above changes:
- On BIOS-based machines:
~]# grub2-mkconfig -o /boot/grub2/grub.cfg
- On UEFI-based machines:
~]# grub2-mkconfig -o /boot/efi/EFI/redhat/grub.cfg
NOTE: In RHEL 4 the IO scheduler selection is not per-disk, but global only.
NOTE: In RHEL 7, the deadline IO scheduler is the default IO scheduler for all block devices except SATA disks. For SATA disk, the default IO scheduler is cfq.
Deadline tunables:
$ grep -vH "zzz" /sys/block/sda/queue/iosched/*
/sys/block/sda/queue/iosched/fifo_batch:16 {number of contiguous io to treat as one}
/sys/block/sda/queue/iosched/front_merges:1 {1=enabled}
/sys/block/sda/queue/iosched/read_expire:500 {time in milliseconds}
/sys/block/sda/queue/iosched/write_expire:5000 {time in milliseconds}
/sys/block/sda/queue/iosched/writes_starved:2 {minimum number of reads to perform,
if available, before any writes}
See "Understanding the Deadline IO Scheduler" for additional and more in-depth information on the deadline scheduler, its tunables and how those tunables change IO selection and flow through the deadline scheduler. The discussion includes how the logic within the deadline scheduler works in choosing which IO to dispatch next.
This solution is part of Red Hat’s fast-track publication program, providing a huge library of solutions that Red Hat engineers have created while supporting our customers. To give you the knowledge you need the instant it becomes available, these articles may be presented in a raw and unedited form.
14 Comments
Hi
How can I to set deadline elevator only for emcpower* devices (or any other string like mpath*) in RHEL5?
Regards.
maybe with udev?
Kinda late but maybe useful for those like me coming across this discussion thread: https://access.redhat.com/solutions/1418713 recommends
dm-
block devices.you can quickly list values of all elevator tunables with
for i in /sys/block/sda/queue/iosched/*; do echo -e "$i \t=\t"
cat $i
; doneor:
grep -v "zZzZ" /sys/block/sda/queue/iosched/*
The above "for...." command syntax didn't work for me,
$ for i in /sys/block/sda/queue/iosched/*; do echo -e "$i \t=\t" cat $i; done
/sys/block/sda/queue/iosched/back_seek_max = cat /sys/block/sda/queue/iosched/back_seek_max
/sys/block/sda/queue/iosched/back_seek_penalty = cat /sys/block/sda/queue/iosched/back_seek_penalty
/sys/block/sda/queue/iosched/fifo_expire_async = cat /sys/block/sda/queue/iosched/fifo_expire_async
/sys/block/sda/queue/iosched/fifo_expire_sync = cat /sys/block/sda/queue/iosched/fifo_expire_sync
/sys/block/sda/queue/iosched/quantum = cat /sys/block/sda/queue/iosched/quantum
/sys/block/sda/queue/iosched/queued = cat /sys/block/sda/queue/iosched/queued
/sys/block/sda/queue/iosched/slice_async = cat /sys/block/sda/queue/iosched/slice_async
/sys/block/sda/queue/iosched/slice_async_rq = cat /sys/block/sda/queue/iosched/slice_async_rq
/sys/block/sda/queue/iosched/slice_idle = cat /sys/block/sda/queue/iosched/slice_idle
/sys/block/sda/queue/iosched/slice_sync = cat /sys/block/sda/queue/iosched/slice_sync
there are several ways to modify, the following modified version worked
$ for i in /sys/block/sda/queue/iosched/*; do echo -e "$i \t=\t" $( cat $i ); done
/sys/block/sda/queue/iosched/back_seek_max = 16384
/sys/block/sda/queue/iosched/back_seek_penalty = 2
/sys/block/sda/queue/iosched/fifo_expire_async = 250
/sys/block/sda/queue/iosched/fifo_expire_sync = 125
/sys/block/sda/queue/iosched/quantum = 4
/sys/block/sda/queue/iosched/queued = 8
/sys/block/sda/queue/iosched/slice_async = 40
/sys/block/sda/queue/iosched/slice_async_rq = 2
/sys/block/sda/queue/iosched/slice_idle = 8
/sys/block/sda/queue/iosched/slice_sync = 100
Hi,
Does Deadline IO Scheduler give better performance on a NFS server VM?
virtual disk or passthru disk? read load or write load or what ratio of same? sequential or random io workload? small or large average io size? The generic answer is try using noop on virtual machines with virt disks and leave it up to the hypervisor to do the io scheduling (its going to do it anyway). The more specific answer is, as with all tuning, use a repeatable baseline workload, make tuning changes one at a time and measure the resulting differences.
It's also possible (sensible?) to tuned.
RHEL7 users (tuned >= 2.0) => How to create a customized tuned profile
RHEL6 users (tuned 0.x) = >How to change the default IO scheduler for a
tuned
profile .Please confirm.
The following line: RHEL 4, RHEL 5, RHEL 6, RHEL 7: add elevator=deadline to the end of the kernel line in /etc/grub.conf file:
should be changed to: RHEL 4, RHEL 5, RHEL 6: add elevator=deadline to the end of the kernel line in /etc/grub.conf file:
correct and corrected. The RHEL7 info for grub2 applies for 7.
Also, I noticed that "deadline" is the default IO scheduler in RHEL 7.x for SCSI drives, however, for SATA drives it is set to "CFQ".
the article needs an update for RHEL-8
PS: see as well What is the suggested I/O scheduler to improve disk performance when using Red Hat Enterprise Linux with virtualization? and specifying "elevator=" on the kernel command line is cease to exist in kernels up from v5.3-rc3-123-g85c0a037dc7a