Poor guest I/O performance KVM Ubuntu 12.04

iokvm-virtualizationperformanceubuntu-12.04vmbuilder

I have a guest VM running inside a 12.04 Ubuntu host. VM was created using the vmbuilder python script.

On the host the phoronix-test-suite "aio-stress" gives a performance speed of >1600MB/s Random Write throughput.

The VM (also running 12.04) gives random write throughput of around 3MB/s. Far, far poorer.
http://openbenchmarking.org/result/1301161-BY-20130116176

I have changed the default file image type from qcow2 to raw on the host to improve the disk throughput and have ensured that the vmbuilder template is edited to use "virtio" as target dev.

This has resulted in a speed improvement to 7.5MB/s — still way below what I would expect.

The same machine running 10.04 (with 10.04 VMs) last year was achieving 700MB/s throughput:
http://openbenchmarking.org/result/1205239-BY-20120523168

Can anyone point me at what might be the problem?

Best Answer

Following IBM recommendations, you should:

  1. Disable caching on your disks. If you use libvirt, simply put cache='none' in your driver section for the disk.

  2. Use noop as elevator in your VM to let hypervisor handle it. Use this as kernel CL in your VM: elevator=noop

  3. On the hypervisor, use deadline elevator: elevator=deadline

  4. On the hypervisor, disable swappiness. Put vm.swappiness = 0 in your /etc/sysctl.conf file. Then, use sysctl -p.

All this should greatly improve your performances. Then, given your (hardware) configuration, more specific hints can be used. I recommend you carefully read the IBM docs.