What is faster on the same hardware, Xen or KVM?

I'm trying to pick-up a virtualization technology to work, which gives the best performance.

There are some benchmarks here that I found on the subject: http://virt.kernelnewbies.org/XenVsKVM

They show KVM as a winner, with significant difference in performance - which goes against the idea that KVM is a type-2 hypervisor, and by definition it should be slower than Type-1 hypervisors (like Xen) - or at least that what the articles on the web say.

Any idea on the subject?


Solution 1:

That benchmark is only comparing the speed of the native OS to a single guest OS. It is hardly a real-world test. I don't think I would put much weight on it. Most of the KVM camp argues that Xen requires too many interrupts and hops between kernel and user space, but from most of the more real-world benchmarks that I've seen that hasn't really been realized and Xen seems to be a bit faster than KVM.

Sorry I don't have a link to back that up handy. But I will say that KVM is improving fast and seems to be catching up on feature set and stability quickly.

As to which approach is better. The Xen camp will argue that a true light-weight hypervisor is required virtualization to be secure and fast. Xen is also starting to be supported in firmware by some vendors which is also nice. The KVM camp will argue that KVM is simpler and that Linux is capable of being a good hypervisor.

In the end it's still unclear which direction will ultimately win. Xen certainly has a head start and already has a nice market share. But it's not in the mainline kernel, yet. Hopefully that will change soon and there has certainly been a lot of talk about this on the kernel list in the past few months. Red Hat is in the KVM camp now and will be pushing it as the virtualization platform of choice. Red Hat Linux 5.4 which is coming out shortly will be the first to include it. So that will likely attract shops that haven't rolled out or committed to a virtualization platform yet.

As far as tools go, both Xen and KVM use libvirt and QEMU and the tools associated with them. So they share many of the same tools such as virt-manager.

We use Xen at work, and it works well for us. But I've been looking into KVM due to some USB forwarding and PCI passthrough issues I've been unable to resolve with Xen. I'm not sure KVM is any better at this, but I guess I'll find out once I try it. One thing I have noticed in researching my USB issues is that KVM's documentation is more assessable and organized compared to Xen's. But there is no perfect virtualization platform so you'll need to figure out what makes sense for you.

Solution 2:

I personally would choose virtualisation based on usability, support, reliability and suitability for the virtual machines you are using.

Xen networking data transfer rates seem to be as good as real hardware, but I've also had some battles with Xen and vLans and multiple Ethernet cards. I have no experience of KVM, but I would also suggest that you consider VMware ESX(i) as well.

Solution 3:

You will find very interesting information on the subject in the following presentation: Quantitative Comparison of Xen and KVM

The person who did this is a Xen expert, but the comparison seems pretty fair.

Solution 4:

I might be going out on a limb here, but I don't think that raw performance is the most important metric when it comes to technologies like this.

I think that usability and interface is important, as well as tools to support a reliable infrastructure. It seems to me that Xen has a far more robust set of existing applications that support it than does KVM. That might not be the case, as I have no evidence to back it up.

Whatever you go with, decide what the best solution is for you, and look at the entire package, not just the raw performance.