Thursday, October 31, 2019

Enable High Performance, Block Multi Queue-IO Scheduler under Ubuntu 16.04 Desktop

Compared to Single Queue-IO Schedulers (eg. cfq, deadline etc), we can gain a high IO performance improvment through MultiQueue IO Schedulers (eg bfq, kyber). These are the new IO Schedulers built in to Linux Kernal 4.12+, but disabled until 5.0. It uses multiple IO Queue (leveraging CPU cores) to provide a high responsive system. These are specificaly designed for Desktop OS. Its architecture has been detailed here and here.

Enabling the same On Ubuntu 16.04 has been mentiond below:

1. Add both mq-deadline, bfq and kyber-iosched, to /etc/modules, to load the modules on startup

2. Append, scsi_mod.use_blk_mq=1 to the GRUB_CMDLINE_LINUX parameter in /etc/default/grub file

3. Create /etc/udev/rules.d/60-scheduler.rules, to assign bfq and kyber to block devices

eg:

# set bfq scheduler for non-rotating disks | SDD
ACTION=="add|change", KERNEL=="sd[a-z]", TEST!="queue/rotational", ATTR{queue/scheduler}="bfq"
ACTION=="add|change", KERNEL=="sd[a-z]", ATTR{queue/rotational}=="0", ATTR{queue/scheduler}="bfq"

# set kyber scheduler for rotating disks | HDD
ACTION=="add|change", KERNEL=="sd[a-z]", ATTR{queue/rotational}=="1", ATTR{queue/scheduler}="kyber"

4. Update grub using “sudo update-grub2” and reboot

5. Now your SSD would be using bfq scheduler, and HDD using kyber scheduler. Enjoy your high responsive system !


References:

https://www.omgubuntu.co.uk/2017/07/linux-kernel-4-12-released-bfq

https://www.thomas-krenn.com/en/wiki/Linux_Multi-Queue_Block_IO_Queueing_Mechanism_(blk-mq)

https://lwn.net/Articles/767987/

https://lwn.net/Articles/784267/

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

https://www.stephenrlang.com/2018/01/io-scheduler-tuning/

https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/7/html/7.2_release_notes/storage

https://www.hecticgeek.com/2016/09/supercharge-ubuntu-16-04-lts-xanmod-kernel/

https://www.cnx-software.com/2019/08/14/bfq-budget-fair-queuing-i-o-scheduler-improves-linux-systems-responsiveness-video/

https://unix.stackexchange.com/questions/375600/how-to-enable-and-use-the-bfq-scheduler

https://wiki.debian.org/SSDOptimization#Low-Latency_IO-Scheduler

No comments:

Post a Comment