How to make the deadline I/O scheduler more write-friendly

Solution Verified - Updated

Environment

  • Red Hat Enterprise Linux 8
  • Red Hat Enterprise Linux 7

Issue

  • Need to make deadline or mq-deadline scheduler more write-friendly

Resolution

  • By default, the deadline (RHEL 7) and mq-deadline (RHEL 8) schedulers generally prioritize reads over writes. If there is a write-heavy work load, and it is found that writes are not given enough priority, we can configure the scheduler to be more write-friendly via the write_expire and writes_starved parameters.

  • To increase write priority:

      # echo    1 > /sys/block/sdc/queue/iosched/writes_starved
      # echo 1000 > /sys/block/sdc/queue/iosched/write_expire
    

This changes the default writes_starved from 2:1 ratio (two reads to 1 write dispatch ratio) to 1:1 ratio of reads to writes. In addition, this lowers the write expire value from 5s to 1s which again gives higher priority to older writes vs next elevator sorted writes.

Please note, each environment is different and there is no guarantee that these particular parameters will produce performance gains. Benchmarking should be done with various values. For example, there have been cases where increasing the write_starved ratio to 4:1 (4 reads per 1 write) actually improved write throughput due to increased io merging opportunity available in writes. Thus the importance of performing benchmarking with any parameter changes.

Root Cause

SBR
Components
Category

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.