Comparing Virtualization Technologies: Linux KVM, OpenVZ, and Xen
DevOps by Timothy Hudson Tags : , , , , ,

The Virtual Private Server, or ‘VPS’ is a very valuable tool for tech focused companies. After all, a VPS is a fantastic way to run an operating system without a physical computer of your own. It’s like having a virtual computer at your disposal, which opens many possibilities for your company. 

Of course, you buy these virtual machines from different providers, meaning they are products; and like all products, there’s the good, the bad, and the debatable. Some VPS providers may outright be better than others, and some may have as many benefits as they do cons. In this article we’ll compare three of the most popular virtualization technologies: Linux KVM, OpenVZ, and Xen.

Virtual Machines vs. Containers

Before we can even discuss the differences in the aforementioned virtualization technologies, it would be prudent to cover the two ways in which virtualization is achieved. These are Virtual Machines and Containers. Of course, there’s actually quite a bit to cover regarding that, but we can break it down simply for you; VM allows you to emulate any OS on a server. If, for instance, a server hosting a VM used Windows, you could still emulate an OS like Linux. Containers, on the other hand, are limited. With containers, the host server may run Linux, in which case you will only be able to emulate virtual machines that also run Linux. 

This is a very basic explanation and doesn’t cover every pro and con to each, so refer to this link for more information on the differences between the two systems.

Linux KVM

Despite the name, Linux Kernel Virtual Machine, or KVM, is not a Linux specific system. It is a kernel module that acts as a framework, allowing you to use a third-party tool like QEMU for virtualization. Because it is a framework, server providers often use third-party tools to create Virtual Machines with a fixed amount of RAM, disk space, etc. You are also able to modify low-level kernel settings with KVM, giving you a bit more freedom in how things work for you. However, KVM only works on hardware that supports hardware-assisted virtualization. On the other hand, it can provide paravirtualization for I/O devices through the ‘Virtio’ API.

Xen

Xen is a virtualization tool that creates VMs with fixed specs, like RAM, cores, etc. Being a virtualization technology, Xen lets you use any OS for the virtual machines it provides; that includes Windows, Linux, and even BSD. And with each of those VMs being capable of running a full OS, you can also upgrade the kernel, add additional ones, or change low-level kernel settings. Normally, there’s a lot of overhead with this type of virtualization, because both hardware functions and OS features have to be emulated. However, Xen has many different ways to employ paravirtualization, using alternate interfaces or QEMU to fully emulate hardware functions. These are some benefits to take into consideration regarding Xen.

OpenVZ

Of the three systems we are discussing here, OpenVZ is the only one that uses containers. It is also a Linux system, meaning you can only use Linux applications with it. Each container with OpenVZ works like an individual Linux system, which means you have root access. Each of these containers is given some RAM, CPU memory, etc., but it works a bit differently than Xen or KVM. While some of those allocated resources are dedicated, others are ‘burstable.’ What this means is that extra resources can be taken from other containers if they are needed. Generally this is only supposed to come from unused containers, but there is a chance that it could come from your container, in which case your virtual machine would have reduced performance. 

OpenVZ also uses a shared kernel, which means you can’t modify it or add extra modules to it. And finally, even though OpenVZ 7 uses a modern Linux kernel, the most commonly offered OpenVZ is 6, which uses Linux 2.6. If you get OpenVZ 6, you won’t be able to use newer Linux distributions, like Docker. On the other hand, being a container type system, it often has less overhead, making it easier for a provider to put more VMs on a single server.

Which of these is Best for You?

Your individual situation will affect which of these systems you need to select. Obviously, if you are not using Linux, OpenVZ won’t be right for you, as it is Linux only. Even if you do use Linux, OpenVZ might not be a good choice unless you can get a provider that offers version 7, since the more common 6 doesn’t let you use newer Linux distributions. But if you are willing to use an older Linux setup, OpenVZ may be the cheapest and least taxing option.

On the other hand, Xen and KVM have more similarities than differences. They work in pretty much the exact same manner, both allowing some degree of personalization and the ability to run whichever OS you need them to. Keep in mind, however, that short of which OS you can use, all of these options can do the same thing; they can all provide a virtual machine to use on a VPS. The only difference is how you get there and how much it costs you to do it. Moreover, this article has only covered each of the three systems mentioned in it briefly, because that’s all we have time for. If you want to conduct more research, this link goes into great detail about all three systems, as well as everything you need to know about how they work.