Tough Choice: Xen or KVM

I'm building a fresh workstation and want to use Linux alongside Windows. This seems like a good opportunity to get acquainted with with either Xen or KVM.

So I face a choice. In favour of using Xen I see a type 1 hypervisor with very clear delineation between domains. KVM on the other hand seems to be ahead in terms of currency with the latest kernel(s).

I googled "xen vs kvm" and pulled apart the first page of results. I've also been through several Server Fault searches and now have a jumble of facts bouncing around my head, not all of which will be current.

In short I'm not really sure which way to jump. What really matters to me is:

  • stability, both in the hypervisor and in the guests
  • reasonable performance, particularly for the Windows guest
  • strong guest isolation
  • ease of management
  • USB pass-through to guests

With all that in mind, which do you think is the better option?


Update - several months later.

For the benefit of anyone with the same questions in the near future, this is how it all played out in the end:

  • I started with Xen on OpenSuse 11.2, several days before 11.3 was due. I found the suse update channels to be very slow (dunno if that was just an issue for me specifically or not). I got Xen up and running quickly but had a lot of grief with the guest's network adapters.
  • Ubuntu 9.10 was released as I was doing this so I decided to give that a try. The system itself was wonderful and KVM just plain worked out of the box. However I had the occasional stability issue that I felt might have been related to KVM (other suspects at the time were Compiz and NFS).
  • To see if the stability issue was tied to KVM I decided to try VirtualBox and found it to be even easier to use with a nice interface and surprisingly good performance.
  • The stability issue hasn't gone away yet so I guess KVM wasn't at fault but at the moment I'm staying with VirtualBox because it just feels nicer to use and has some good features combined with good performance.

This where I'm at today. Hope this is useful to someone.


Solution 1:

I would go with XEN. Two main reasons. First, you can get it installed and configured painlessly by installing OpenSUSE 11, and you get a GUI to administer it as well. But all the technical stuff is still there at the shell prompt so that you can learn the innards of XEN as and when you want to. Second reason is that XEN is the top choice of companies who provide VPS hosting, and if you think that you might someday want to use your knowledge to get a job, XEN is a better bet. If you are thinking of the career enhancing effect, make sure to look at the innards of XEN, the network virtualization on Linux (which is not part of XEN but useful for building testbeds of routed VMs) and the XEN api. There are various XEN management packages which take care of management for you, but in specialised scenarios, it is always good to be able to write some scripts (probably in Python) to do your own management/monitoring/reporting.

XEN meets all your bullet points and has been around for longer which is why it is the choice of hosting folks.

Note that you might want to also check out OpenVZ which is completely different from XEN but also gets used a lot by VPS hosting companies. Since OpenVZ uses a container model of virtualisation, you can actually run OpenVZ inside a XEN guest.

While you are doing this, think about your disk storage. You probably want volume management, which is also included in OpenSUSE with a nice GUI, so that you can assign hard disk partitions or volumes to the guest OS. For instance, you could even set it up so that a Windows partition can be booted from, or used by the XEN guest.

Solution 2:

Ease of management is achieved by using libvirt which will present the same interface whether you use Xen or KVM. Stability is very much a function of the underlying distribution - Xen only works well with certain (generally older) kernels, whereas KVM is mainline and so gets fixes with every release.

Solution 3:

RedHat and Canonical (Ubuntu) both are choosing KVM as the virtualization method going forward. I fired up a KVM server with RedHat 5.4 and had no issues running it running the server or guests in a desktop environment. It seems to me the market is starting to favor KVM.

https://wiki.ubuntu.com/UbuntuWeeklyNewsletter/Issue76

http://www.redhat.com/virtualization-strategy/

Solution 4:

For a workstation, I'd take KVM. I use it for my development VMs on my laptop and it works marvellously. I use Xen extensively in the datacentre, but I don't like it for workstation use, it's architecture is just a bit weird for that, and has caused hardware support hassles for me in the past (admittedly, it was fairly far in the past).