Virtual Insider

Blog archive

Hyper-V Quick Tip: Improving Linux Disk I/O

One of the complaints I typically hear about Hyper-V is that while Windows performance is quite solid, when it comes to Linux the performance is just not there. Today, I want to introduce you to a tip that will improve your Linux VM performance anywhere from 20 to 30 percent.

Linux kernel 2.6 and newer offer four different I/O elevators -- that is, it uses four different algorithms to accommodate different workloads and provide optimal performance. These elevators are:

  • Anticipatory: This is ideal for an average personal computer with a single SATA drive. As the name suggests, it anticipates I/O and writes in one large chunk to the disk as opposed to multiple smaller chunks. This was the default elevator prior to kernel 2.6.18
  • Complete Fair Queueing (CFQ): This algorithm is ideal for multi-user environments, as its implements a Quality of Service policy that creates a per-process I/O queue. This is ideal for heavy workloads with competing processes and is the default elevator as of kernel 2.6.18.
  • Deadline: A round robin-like elevator, this deadline algorithm produces near real-time performance. This elevator also eliminates the possibility of process starvation.
  • NOOP: Aside from its cool name, NOOP stands for "No Operation." Its I/O processor overhead is very low and it is based on the FIFO (First In, First out) queue. NOOP pretty much assumes something else is taking care of the elevator algorithm, such as, for example, a hypervisor.

All these algorithms are great, except in a virtual machine these are bottlenecks since the hypervisor is now responsible for mapping the virtual storage to physical storage. As a consequence of this, it is highly recommended that you set the elevator algorithm to NOOP which is the leanest and simplest elevator for virtualized environments. NOOP allows for the hypervisor to then assign the ideal elevator and that in turn yields better performance for Linux VMs. The only prerequisite for this tweak is that the Linux distribution you are using must be at kernel version 2.6 or newer.

You can make this configuration change by editing the boot loader's configuration file /etc/grub.conf and setting / and adding elevator=noop.

It is also worth noting that as of kernel 2.6.18, it is not possible to set elevators at a per-disk subsystem level as opposed to a system level.

Posted by Elias Khnaser on 06/23/2014 at 4:12 PM


Featured

Subscribe on YouTube