Improve Linux VM IO performance by disabling IO Scheduler
For a little while now we’ve been seeing RedHat Linux virtual machines performing poorly. Tasks would take considerably longer on the Linux VM’s then other Windows VM’s. After digging around I eventually found that RedHat has it’s own IO scheduler that runs in the background. On a physical box this wouldn’t be a big deal, but as a virtual machine everything is already being processed by VMware hypervisor. The fix, disable the IO Scheduler!
Check Linux IO Scheduler
To check the IO Scheduler run the following command, replacing sdx with a,b,c, etc for each of your disks.
# cat /sys/block/sdx/queue/scheduler noop anticipatory deadline [cfq]
Disable Linux IO Scheduler
To disable the IO Scheduler run the following command, replacing sdx with a,b,c, etc for each of your disks.
# echo noop > /sys/block/sdx/queue/scheduler
In our case our VM has two disks, we ran the commands like such:
# echo noop > /sys/block/sda/queue/scheduler # echo noop > /sys/block/sdb/queue/scheduler
You will need to reboot the VM for the change to take effect.
If you want to change the schedule for all block devices permanently, you can set it as a boot option by editing the file /boot/grub/grub.conf and adding the to end of the Kernel line:
The change was certainly worth it! We ran a benchmark and our before disk io was roughly 60-70 MB/s and after our disk io is a little over 3GB/s!
Emmm , you missed the command :
echo noop > /sys/block/sda/queue/scheduler
Doh! That’s kind of important too, thanks for catching that!