Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

What is faster on 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 then Type-1 hypervisors (like Xen) - or at least that what the articles on the web say.

Any idea on the subject?

Thanks!

share|improve this question
    
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 ? –  Antoine Benkemoun Jul 17 '09 at 6:29
    
KVM is NOT a type 2 hypervisor. It is definitely type-1, and it is definitely closer to the hardware than Xen is. So yes, given the exact same conditions, KVM should perform better, especially with the modern virtIO drivers –  dyasny Jun 4 '10 at 19:51

7 Answers 7

up vote 30 down vote accepted

That benchmark is only comparing the speed of the native os to a single guest os. 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 already. 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. RedHat is in the KVM camp now and will be pushing it as the virtualization platform of choice. RHEL 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.

share|improve this answer
    
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 Jul 18 '09 at 18:06
1  
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. –  3dinfluence Jul 18 '09 at 23:43
    
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. –  jkp Nov 15 '10 at 18:22
1  
@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. –  3dinfluence Nov 15 '10 at 18:36
1  
@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. –  jkp Nov 16 '10 at 9:31

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.

share|improve this answer
1  
Vmware server IO performance is very, very bad. If you have to go vmware use esx. –  ko-dos Jul 17 '09 at 15:00

You will find very interesting information on the subject in the following presentation : http://www.xen.org/files/xensummitboston08/Deshane-XenSummit08-Slides.pdf

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

share|improve this answer
    
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? :) –  SyRenity Jul 18 '09 at 18:20
    
I believe my presentation seems more realistic. It runs more then one VM at at time. The testing protocol seems closer to reality. –  Antoine Benkemoun Jul 19 '09 at 9:38
    
+1 Interesting presentation! Xen seem to have better isolation. –  Jonas Mar 5 '11 at 15:48

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|improve this answer
    
You need to have a look at RHEV - management is very simple and user friendly. –  dyasny Mar 19 '10 at 14:43

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.

share|improve this answer

A lot of the difficulty or ease in setting up KVM is distribution-dependent. Picking a Xen-centric distribution will make Xen easier. Picking a KVM-centric distribution will make KVM easier.

The tools question is somewhat irrelevant because both use libvirt. This means you use the same management tools for both in most cases.

share|improve this answer

From what I've read, KVM integrates with the linux kernel and has more direct access to hardware. When you've got tighter integration, that should imply faster performance.

However, like Matt said in his answer above, what matters is the tooling. I put aside about 5 hours to play with KVM and it's hard. I've decided I'm going to wait another 6 months to see if anyone makes some better tools for it before jumping in.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.