Xen vs. KVM in performance

69,357

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

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.

Solution 5

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.

Share:
69,357
SyRenity
Author by

SyRenity

Updated on September 17, 2022

Comments

  • SyRenity
    SyRenity almost 2 years

    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?

    • Antoine Benkemoun
      Antoine Benkemoun almost 15 years
      That comparison seems pretty bad as it compares KVM+1xVM and Xen+1VM... What is the point of having virtualization if you only have on VM ?
    • thomasrutter
      thomasrutter almost 7 years
      If you're reading this in 2017 (someone did a trivial edit to the question) then realise that this question and its answers are EIGHT YEARS OLD. KVM vs Xen landscape is very different now.
  • ko-dos
    ko-dos almost 15 years
    Vmware server IO performance is very, very bad. If you have to go vmware use esx.
  • SyRenity
    SyRenity almost 15 years
    Any idea if same will hold in future? As Redhat 5.4 is coming soon with native KVM support, I'd like to know what I won't have to switch to KVM from Xen in 1/2 year. Thanks.
  • SyRenity
    SyRenity almost 15 years
    Thanks for the presentation, reading it seems that while Xen is tops on CPU and Network IO, KVM tops on HD IO. But reading this numbers (virt.kernelnewbies.org/XenVsKVM), seems that KVM won hands up on every comparison. Any idea where is the truth? :)
  • 3dinfluence
    3dinfluence almost 15 years
    I can't make any predictions on what the future holds. But neither of these platforms are going to disappear. RedHat has said that they are committed to supporting Xen as well as KVM. Only time will tell how this one plays out. But I wouldn't worry about having to change in 6 months. Maybe in a few years there will be a clear leader in the opensource virtualization platforms.
  • Antoine Benkemoun
    Antoine Benkemoun almost 15 years
    I believe my presentation seems more realistic. It runs more then one VM at at time. The testing protocol seems closer to reality.
  • David Corsalini
    David Corsalini over 14 years
    You need to have a look at RHEV - management is very simple and user friendly.
  • jkp
    jkp over 13 years
    Interesting you note moving to KVM for USB support - I've just had to think about moving away due to the lack of USB 2.0 support! I'm guessing from your post that Xen isn't going to be much better.
  • 3dinfluence
    3dinfluence over 13 years
    @jkp I was waiting for a few other pieces of our infrastructure to be replaced. Which was just completed. So in the coming weeks I may be able to look closer at KVM. However in my case the hardware doesn't support IOMMU (VTd). So I'm not sure if moving to KVM will help. XEN requires IOMMU support for pci passthrough. But KVM supports USB and PCI element passthrough using libvirt. So I'm hoping that will work without IOMMU. Right now under Xen the only way that I know to pass USB through is pass the USB PCI controller through but that information may be dated at this point.
  • jkp
    jkp over 13 years
    @3dinfluence: I think you might misunderstand how USB and PCI support is implemented - libvirt doesn't do any of these things itself, it only provides a way of configuring the underlying capabilities of the VM hypervisor. In this case the capabilities are provided by a combination of the KVM kernel modules and the Qemu userspace code.
  • 3dinfluence
    3dinfluence over 13 years
    @jkp No I'm aware of that but since I use libvirt to define and manage my VM's I'll be using the libvirt interface, xml files, to set this up. KVM via libvirt does allow for passing USB and PCI devices through without IOMMU. On libvirt.org/formatdomain.html#elementsUSB you'll notice that only KVM supports this libvirt feature. I'm sure it's using some Qemu code to make that happen which is why it's not supported under XEN.
  • jkp
    jkp over 13 years
    ahhhh, im with you now. yeah, I used to use libvirt and virsh but it was to cumbersome, then I moved away but now I'm back with virt-manager over forwarded X. Got tired of maintaining my own scripts and config files :)
  • Jonas
    Jonas over 13 years
    +1 Interesting presentation! Xen seem to have better isolation.
  • Yamaneko
    Yamaneko about 10 years
    @3dinfluence You said: "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." Do you have any updates on this?
  • ALex_hha
    ALex_hha over 6 years
    Note: Amazon uses modified version of KVM, not a native one. And I wouldn’t say that they have typical workloads, probably they have a really heavy and uncommon workloads, imho
  • Philipp Claßen
    Philipp Claßen over 6 years
    @ALex_hha What I meant is that they have to choose a technology that works best for the applications that their customers will run. In that sense, they have to find a setup that is fast over different use cases. But I agree that there are other scenarios, like embedded systems, where Xen may comparable more favorably.