In my xen virtual machines, I found that switching my disk image files from file: to tap:aio: made the machines (all HVMs) run much better with far fewer hangs and glitches.
If I were to try to run with KVM rather than XEN, is there some equivalent of something like tap:aio that provides better disk performance, or is the KVM equivalent of file: the only way to access a disk image in a file?
(I hasten to add I have absolutely no idea what the heck file: versus tap:aio: means, I just tried it when I saw it mentioned somewhere and it worked much much better :-).
On Wed, Jul 01, 2009 at 10:57:15AM -0400, Tom Horsley wrote:
In my xen virtual machines, I found that switching my disk image files from file: to tap:aio: made the machines (all HVMs) run much better with far fewer hangs and glitches.
If I were to try to run with KVM rather than XEN, is there some equivalent of something like tap:aio that provides better disk performance, or is the KVM equivalent of file: the only way to access a disk image in a file?
(I hasten to add I have absolutely no idea what the heck file: versus tap:aio: means, I just tried it when I saw it mentioned somewhere and it worked much much better :-).
Yes there certainly is.
There are two issues here.
Issue (1): is the virtual disk backed by a file or a partition/LVM?
If the virtual disk sits in a file on a filesystem, then to access that we have to do through the whole filesystem stack on the host. If the virtual disk sites in a partition or LV, then there is much less overhead on the host.
Issue (2): does the guest use fullvirt emulation or paravirtualization (PV) to access the virtual disk?
Full emulation of (eg.) IDE and SCSI devices is very inefficient. It's far better if the guest cooperates with the host (paravirtualization).
The fastest case will be (1) == partition/LVM, (2) == PV drivers.
On Xen, file: -> tap:aio: essentially converts the guest from using full emulation to paravirt drivers.
On KVM, you can do the same thing by installing virtio drivers (not just for disk, for network too). If you are installing a relatively recent guest on a relatively recent host (eg. Fedora 10+ on Fedora 10+, or RHEL 5.3 on Fedora 11), then virtio should just work.
You can tell if the guest can support Xen PV drivers or virtio using our virt-inspector tool, or looking inside the guest at the start-up messages.
http://wiki.libvirt.org/page/Virtio
Rich.