Label
Message
X

KVM Virtualizaton Technology: Evolving and Comparison to Xen
Here at Natcoweb we offer KVM-based VPS solutions. Read what Natcoweb network engineer Sergii Kononienko says on KVM vs Xen virtualization technologies evolution:
"If Xen will die or not die, I don't know. But KVM will take over and be the virtualization selection of choice."
Benny Schnaider, CEO and co-founder of Qumranet.
Xen appeared to be among the first open-source and production-ready projects and was doing rather well. Xen and KVM are similar in that both have an almost identical set of features for virtualization. In this article we won't take into consideration technologies with the shared kernel such as openvz or vserver. How come Linux developers chose KVM as the main virtualization technology and included it first into the main kernel?
Although virtualization technologies are in the hype today, the underlying method has been around for quite a while. In its time, Xen was the only open-source technology with good enough performance and stability. The Xen developers re-invented the method used in IBM mainframe: a separate hypervisor (Xen itself) above all operating systems that controls the domainU virtual machines and the guest OSes inside them. To make hypervisor interface directly to hardware is not a simple task as it requires writing drivers for every piece of hardware supported by the X86 platform. Therefore, Xen uses a special domain0 guest operating system, which utilizes a specifically modified Linux kernel. DomU operating systems need to be explicitly ported to a virtual machine architecture. This method is referred to as paravirtualization, the main idea being that the guest operating system knows it's running as a virtual machine and thus talks to the hypervisor directly. It's generally faster than full hardware emulation and it works on older systems with no hardware-assisted virtualization. This feature proved to be both an advantage and a disadvantage. The need to change Linux kernel is the object of heated discussion.
It happens that Xen code doesn't fit in well with other parts of the kernel. After a few adjustments here and there the code snippets for domU were accepted into the main Linux kernel, but the dom0 code was rejected for crudeness by maintainers, including Linus Torvalds himself. The developers of Xen had nothing to do but release appropriately modified versions of Linux kernel for dom0 on their own. Not surprisingly, they could hardly keep up with the official kernel releases.
The KVM architecture is fundamentally different. In fact it's a small kernel module that allows a well-known and widely used QEMU emulator to use hardware virtualization that appeared with the new Intel an AMD processors (namely VT-X and AMD-V technologies here). The KVM code is lightweight and it doesn't conflict with other parts of Linux kernel, which certainly made the developers' mind. KVM managed to boost the performance of QEMU virtual machines. However, a large portion of virtualization still happened in user-space and that is less effective than virtualization fully in kernel-space as in Xen.
As Xen struggled with a number of issues, KVM flourished within the official kernel. It acquired paravirtualization elements such as VirtIO disks and network cards, increasing the overall effectiveness of guest OSes (in case drivers were availiable). What is more, the Linux kernel could now determine whether it's running in a virtual machine under KVM and optimize its performance accordingly. Also there is a tendency of pulling the functionality from user-space process of QEMU into the kernel. For instance, the network card can be fully emulated in host kernel without the excessive switch to user-space. Similar code is likely to appear for disks emulation in the nearest future. The latest generation of Intel and AMD processors have an enhanced virtualization support (EPT and RVI technologies respectively), which help full virtualisation match the speed of paravirtualization. Being already in the official kernel and thus in most of the Linux disrtributives, KVM went through extensive testing resulting in greater reliability and quality of code.
The original developer and maintainer of KVM, the Qumranet company, was bought by the largest Linux distributor, RedHat, that invested a great deal of effort and resources to bring KVM up to a corporate-grade solution. In the meantime, Xen didn't just sit there with their hands folded as well. Now it has hardware-assisted virtualization too. The most recent version even boasts the hybrid mode of full and paravirtualization. The main objective of Xen, however, remains unchanged: to get the dom0 code accepted into the main Linux kernel. They had to do a lot of work rewriting the code and almost made it - a portion of the new code is incorporated in 2.6.37 kernel. Regrettably, the stability of the new code leaves much to be desired and is unlikely to be used in production at the moment.
In the future, the developers of Xen might overcome this issue as the code is gradually starting to look better. Currently KVM is the simple, efficient and stable solution, combining the support of recent technologies of hardware-assisted virtualization with paravirtualization, nwhat's more, it's supported by the biggest developers and distributors of Linux. Thus KVM is a more suitable and promising technology for VDS hosting and that is the reason our company has chosen it».
By Sergii Kononienko, Natcoweb