Xen vs. KVM in performance

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.


Solution 5:

FWIW: The answer depends entirely on your needs, now and in the future.

Yes, I know that's an unhelpful answer. Unfortunately, it's true. Your choice of virtualisation will affect pretty much everything you do afterwards, so you need to ask yourself a few questions.

(1) Is the difference between 97% of native performance and 96% of native performance (figures plucked out of the air) really that important to you?

(1a) If one does better with HD access (which really implies that you're either using a whacking great database, or you can't afford the extra RAM), and the other does better with networking, which is more important to you?

(2) Are you confident using the tools provided with either solution?

(3) Does the fact that one is (sort of) native to recent Linux kernels, and the other one not, make a difference?

(3a) Do you now, or have you ever been ... er ... will you ever need to run a different OS under virtualisation? It doesn't have to be Windows. It might be FreeBSD, or even Haiku, or whatever. (Xen probably wins here, but I suggest you check.)

Looking at the big picture, I see KVM as Linux' answer to Solaris zones. (I'd rather have Solaris zones, but I see the parallel.) I see Xen as a mature hypervisor technology with support for multiple OSes, but then if you don't need multiple OSes, that doesn't matter so much.

To be absolutely honest, you can't go far wrong either way (given caveats above). I prefer Xen, because I went to Cambridge; but then, if I worked for RH, I'd probably prefer KVM.