Scheduling disk i/o on fedora 26.

Scheduling disk i/o on fedora 26.

By default on linux machines cfq i/o scheduler is used, Completely Fair Queuing (CFQ) is an I/O scheduler for the Linux kernel.

cfq scheduler is generally idel and suitbale for genreal system workloads.

If the server is used for virtualization like kvm,vmware it needs to have optimized throughput.
for this we can use deadline i/o scheduler to achieve maximum performance.

deadline is scheduler is selected if tuned is used as virtual-host option.

If the machine is running as virtualization guest then best performance optimization can be achieved with noop scheduler.

kvm guests often benefit greatly from the noop I/O scheduler, which allows the host/hypervisor to optimize the I/O requests and prioritize based on incoming guest load.

Checking i/o scheduler options.

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

cfq is selcted as default disk scheduler, lets change it to deadline.

$ echo 'deadline' > /sys/block/sda/queue/scheduler

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

Add elevator=deadline to grub_cmdline,After the above changes grub2 has to be rebulild with deadline grub command line option.

Here is my grub2 file

$cat  /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="rhgb quiet video=SVIDEO-1:d elevator=noop"
GRUB_CMDLINE_LINUX="rhgb quiet video=SVIDEO-1:d console=tty0 console=ttyS0,115200n8 elevator=deadline"
#GRUB_TERMINAL=serial
GRUB_SERIAL_COMMAND="serial --speed=9600 --unit=0 --word=8 --parity=no --stop=1"
GRUB_DISABLE_RECOVERY="true"
GRUB_BACKGROUND="/boot/grub2/themes/linux.jpg"
GRUB_GFXMODE="800x600"
export GRUB_COLOR_NORMAL="white/black"
export GRUB_COLOR_HIGHLIGHT="yellow/red"

Building grub2 from grub2-mkcondig command.

$grub2-mkconfig -o /boot/grub2/grub.cfg 
Generating grub configuration file ...
Found background: /boot/grub2/themes/linux.jpg
Found linux image: /boot/vmlinuz-4.15.12-201.fc26.x86_64
Found initrd image: /boot/initramfs-4.15.12-201.fc26.x86_64.img
Found linux image: /boot/vmlinuz-4.12.12-300.fc26.x86_64
Found initrd image: /boot/initramfs-4.12.12-300.fc26.x86_64.img
Found linux image: /boot/vmlinuz-0-rescue-a9ee22a02eb84257a4948e9fdc6ebe84
Found initrd image: /boot/initramfs-0-rescue-a9ee22a02eb84257a4948e9fdc6ebe84.img
done

Chekcing the i/o disk status

#grep -vH "zzz" /sys/block/sda/queue/iosched/*
/sys/block/sdb/queue/iosched/back_seek_max:16384
/sys/block/sdb/queue/iosched/back_seek_penalty:2
/sys/block/sdb/queue/iosched/fifo_expire_async:250
/sys/block/sdb/queue/iosched/fifo_expire_sync:125
/sys/block/sdb/queue/iosched/group_idle:8
/sys/block/sdb/queue/iosched/group_idle_us:8000
/sys/block/sdb/queue/iosched/low_latency:1
/sys/block/sdb/queue/iosched/quantum:8
/sys/block/sdb/queue/iosched/slice_async:40
/sys/block/sdb/queue/iosched/slice_async_rq:2
/sys/block/sdb/queue/iosched/slice_async_us:40000
/sys/block/sdb/queue/iosched/slice_idle:0
/sys/block/sdb/queue/iosched/slice_idle_us:0
/sys/block/sdb/queue/iosched/slice_sync:100
/sys/block/sdb/queue/iosched/slice_sync_us:100000
/sys/block/sdb/queue/iosched/target_latency:300
/sys/block/sdb/queue/iosched/target_latency_us:300000