Changing linux I/O scheduler for VMware guest

    • OMV 2.x
    • Resolved

    This site uses cookies. By continuing to browse this site, you are agreeing to our Cookie Policy.

    • Changing linux I/O scheduler for VMware guest

      Hi,

      Following VMware recommendations on how to change linux I/O scheduler for guests, I'm trying to do it on my OMV VM machine running Debian Wheezy.

      First, lets check which I/O scheduler is configured:

      Source Code

      1. $ cat /sys/block/sda/queue/scheduler
      2. noop deadline [cfq]​


      As we can see above for device /dev/sda, the CFQ (Completely Fair Queueing) is the default scheduler that's being used, the one selected in brackets. Since the recommendation for VMware Virtual Machines is to change the scheduler to "noop" (as the hypervisor has its I/O scheduler), we can change it on the fly:

      Source Code

      1. ​$ echo noop > /sys/block/sda/queue/scheduler
      2. $ cat /sys/block/sda/queue/scheduler
      3. [noop] deadline cfq


      This change is only temporary and will reset back to the default scheduler, CFQ in this case, when the machine reboots. To make the setting permanently, I've tried to change the grub configuration file by editing /etc/default/grub and add "elevator=noop" setting to GRUB_CMDLINE_LINUX_DEFAULT parameter, like below :

      Source Code

      1. ​$ vi /etc/default/grub
      2. GRUB_CMDLINE_LINUX_DEFAULT="elevator=noop quiet"
      3. $ update-grub2
      4. Generating grub.cfg ...
      5. Found linux image: /boot/vmlinuz-3.16.0-0.bpo.4-amd64
      6. Found initrd image: /boot/initrd.img-3.16.0-0.bpo.4-amd64
      7. Found linux image: /boot/vmlinuz-3.2.0-4-amd64
      8. Found initrd image: /boot/initrd.img-3.2.0-4-amd64
      9. done


      I could check that the new setting was added to /boot/grub/grub.cfg:

      Source Code

      1. $ grep noop /boot/grub/grub.cfg
      2. linux /boot/vmlinuz-3.16.0-0.bpo.4-amd64 root=UUID=1b9bcd41-d527-487d-ac30-3820137d8eea ro elevator=noop quiet
      3. linux /boot/vmlinuz-3.2.0-4-amd64 root=UUID=1b9bcd41-d527-487d-ac30-3820137d8eea ro elevator=noop quiet


      The problem is that after system restart, the CFQ I/O scheduler is still active for /dev/sda:

      Source Code

      1. ​# cat /sys/block/sda/queue/scheduler
      2. noop deadline [cfq]


      I've done the same configuration on Ubuntu Server 14.04 and CentOS 7 and everything worked fine after boot.
      Am I missing something?

      Thanks.
      OpenMediaVault 2.2.14 (Stone burner)
      VMware ESXi 5.5U3 (build-5230635) | HP ProLiant MicroServer Gen8 | Intel Xeon CPU E3-1265L V2 @ 2.50GHz | 16GB RAM | 250GB SSD + 4x 3TB HDD
    • Hi,

      Yes, I've run update-grub2 (which is a soft link to update-grub) as stated in my post.
      I know I can get a workaround to change the I/O scheduler, but I want to understand why changing grub did not worked out.

      Thx.
      OpenMediaVault 2.2.14 (Stone burner)
      VMware ESXi 5.5U3 (build-5230635) | HP ProLiant MicroServer Gen8 | Intel Xeon CPU E3-1265L V2 @ 2.50GHz | 16GB RAM | 250GB SSD + 4x 3TB HDD
    • Hi,

      I think I've found why editing grub default did not worked. It seems that OMV has placed a file in /etc/udev/rules.d called 99-openmediavault-scheduler.rules

      Source Code

      1. $ cat /etc/udev/rules.d/99-openmediavault-scheduler.rules
      2. # Set 'cfq' scheduler for rotating devices.
      3. SUBSYSTEM=="block", KERNEL=="[sh]d[a-z]", ACTION=="add|change", ATTR{queue/rotational}=="1", ATTR{queue/scheduler}="cfq"
      4. # Set 'deadline' scheduler for non-rotating devices.
      5. SUBSYSTEM=="block", KERNEL=="[sh]d[a-z]", ACTION=="add|change", TEST!="queue/rotational", ATTR{queue/scheduler}="deadline"
      6. SUBSYSTEM=="block", KERNEL=="[sh]d[a-z]", ACTION=="add|change", ATTR{queue/rotational}=="0", ATTR{queue/scheduler}="deadline"


      As we can see above, this udev rule is forcing all detected HDD with rotational=1 (either hdX or sdX) to change the scheduler to "cfq". Since VMDK disks on VMware are detected as rotational disks, my edit on grub was being overwritten by this udev rule.

      In OMV, to change the I/O scheduler permanently for virtual disks , we only need to edit this rule and change the scheduler to "noop", like this:

      Source Code

      1. $ vi ​/etc/udev/rules.d/99-openmediavault-scheduler.rules
      2. SUBSYSTEM=="block", KERNEL=="[sh]d[a-z]", ACTION=="add|change", ATTR{queue/rotational}=="1", ATTR{queue/scheduler}="noop"


      After boot, scheduler was changed like I wanted to.

      Hope this will help other users.

      Thx
      OpenMediaVault 2.2.14 (Stone burner)
      VMware ESXi 5.5U3 (build-5230635) | HP ProLiant MicroServer Gen8 | Intel Xeon CPU E3-1265L V2 @ 2.50GHz | 16GB RAM | 250GB SSD + 4x 3TB HDD
    • I run a lot of OMV VMs in VMs and have never changed the scheduler. I realize it may be a VMware recommendation but I don't think it is necessary.
      omv 4.1.12 arrakis | 64 bit | 4.15 proxmox kernel | omvextrasorg 4.1.11
      omv-extras.org plugins source code and issue tracker - github

      Please read this before posting a question and this and this for docker questions.
      Please don't PM for support... Too many PMs!