Xen and OpenVZ can be seen as one of the same both being virtualisation technologies they are actually very different. As a lot of you know Crucial Paradigm has been offering Xen based virtual private servers for some time now and to date we’ve built up a solid name for ourselves due to the stability and performance of the product we offer.
Moving forward however we’re in the process of deploying other vitalisation technologies and these include OpenVZ and a VMware Enterprise Cloud Hosting solution which I am really looking forward to! One thing to note is that we’re releasing these ‘flavours’ of virtual servers not because one solution is better than the other but because they each can serve you better/differently depending on the appliance and your requirement.
In this article I’ll shed more light on the Xen Vs. OpenVZ battle that is currently ongoing and by the end of this article I hope that you will have a better understanding of the two.
Both are virtual technologies are offered free, Open VZ is the free version of Parallels Virtuozzo while Xen does have its big brother Xen Enterprise which includes cool features like HA (High Availability) and clustering but of course it does come at a price . Let’s now break down what makes Xen and OpenVZ different to each other.
Xen is what we call a para-vitalisation platform and it is the closest you can get to hardware emulation. It works by creating an interface between the environments operating system and the hardware of the node server. Ok so what does this mean? Well put simply it gives you the feel, and behaviour of a dedicated server. You can completely customise your Kernal and even upload your own modules, your memory and disk space is also guaranteed and the end result is a predictable and stable virtual server. Crucial Paradigm offers Linux and Windows based Xen virtual servers as well as our budget product the Xen-VSALE Virtual Server. OpenVZ on the other hand is what we call an operating-system virtualisation technology meaning that each virtual server is basically a layer over the underlying Operating System, in the case of what Crucial Paradigm offers, Centos. This technology is based on a single Linux Kernal which has been modified to support multiple virtual server environments. The Kernal isolates the file system and memory along with each virtual server running on the host node. This method can allow an OpenVZ virtual server to perform faster than a Xen based virtual server due to its simplicity and lower overheads however this benefit can soon disappear if your host decides to oversell the resources on the host node which unfortunately does happen relatively a lot, I’ll touch on this overselling ability later in this article.
Below are two images of how Xen and OpenVZ actually work.
The key differences between Xen and OpenVZ
There are a number of key differences between the two competing technologies, these include:
- Memory allocation
- Firewall Configuration
- Custom Kernals
- Virtual Server Isolation
Memory, Memory and more Memory
Xen Memory Model
If you have a Xen VPS with 512MB of memory then what you have is a VPS with 512MB of memory, just like you would have on a dedicated server. The resources are real and have been allocated to you and only you,, it’s that simple! Now what happens when the server runs out of memory? Well it will start to swap just like your old dedicated server or the PC your using to read this article. Each VPS is allocated the same amount of swap space as RAM so a 512MB VPS will also have 512MB of Swap space but before you jump the gun and think that you essentially have 1GB of accessible memory just remember the swap space is your actually your hard drive space and when your VPS is constantly running low on memory and swapping like mad you will see a considerable performance decrease with your VPS. Fortunately this is something that you can see happening (Xen is predictable remember). Swap space should not be seen as additional RAM but rather as a warning alarm that your VM is running low on memory and it could be time to upgrade.
OpenVZ Memory Module
OpenVZ/Virtuozzo allocates memory differently to Xen (remember this is an OS level virtualisation technology) I’ll briefly explain how memory is allocated. If you have a 256MB VPS you will actually see available RAM of around 230MB this is named “privvmpages” the other 16MB (give or take) is allocated to “kmemsize” and other various resources. One issue that can arise with OpenVZ is when “privvmpages” runs out and the host node is oversold, instead of slowing to halt the VM will run out of memory and crash (think 747 losing its wings and falling from 35 thousand feet). Now I know you’re probably asking ‘what about burstable memory wont help this prevent a crash?’ Well OpenVZ does allow you to burst your memory and it’s recommended to set this to 2 x ‘privvmpages’. Having 2 x burstable memory doesn’t actually mean that you will have access to this memory however, this memory is drawn from other VM’s when they aren’t using all their memory and it’s great in theory however it does make the VPS less predictable and of course if you host is overselling you can run in to issues. Crucial has started offering OpenVZ on our VSALE range of servers and we are also looking to offer OpenVZ on our Cloud range in the coming months. If you would like to register your interest in testing the product please email us.
OpenVZ/Virtuozzo doesn’t allow full access to iptables, this can cause headaches when you’re trying to firewall your VPS, Xen on the hand does not have this limitation.
Xen allows you to have custom Kernals so each VPS that is created on the Node can be unique. OpenVZ on the other hand shares the same kernel for all VPS instances, you might argue that the ability to have custom kernals on Xen also provides increased security.
Due to Xen had capping resources such as RAM and Disk Space what you end up with is an isolated VM, you never hear about Xen VM’s bringing down or affecting other VMS’s on the host node. With OpenVZ people may argue that you see slightly better performance however any performance benefit can quickly disappear if your VPS provider is overselling the resources on the Node and other VM’s are constantly bursting their RAM limits.
Is one really better than the other? No, it really depends on what you’re after, I personally prefer Xen because performs and feels like a ‘dedicated server’, Xen offers predictable performance, isolation and customisation and that’s what’s important to me however if you’re after a fast, simple Virtual Server OpenVZ may be what you’re looking for and Crucial will soon be releasing OpenVZ on our Cloud range of Virtual Servers but of course the proper way, non oversold, solid performing Virtual Servers just like were known for.
Since this question surfaces from time to time, here is a short description of the main difference between OpenVZ and KVM. Basicly it is two different ways to offer virtualization, OpenVZ using shared resources and KVM using full virtualization.
This is not ment to be a deep technical analysis, see this as an introduction or “for dummies” guide.
Lets start with a short explanation about what OpenVZ and KVM are, list some pros and cons of each virtualization type and then end with some guidelines when to choose what type and a personal recommendation.
OpenVZ is container-based virtualization for Linux. OS level virtualization means many basic components exist once on the machine, and are used by all guests (like the identical kernel). That means that each container shares the same underlying OS but still operates as secure, isolated Linux container. Each container performs and executes exactly like a stand-alone server; a container can be rebooted independently and have root access, users, IP addresses, memory, processes, files, applications, system libraries and configuration files. This way you use the resources more efficient but at the same time you can not run different OS types (Linux and Windows).
Some pros with running OpenVZ is good performance and less resources needed for the host.
For the end user it often comes with predefined templates that are easily installed with only a few clicks.
The cons however is that it’s not easy to migrate to other platforms, the only kernel modules available are the ones loaded by the host and if you are missing something, it is up to the provider to add it or not.
KVM (Kernel-based Virtual Machine) is, on the other hand a full virtualization solution for Linux containing virtualization extensions (Intel VT or AMD-V). Using KVM, one can have Linux and Windows virtual machines running side by side on the same hardware . Each virtual machine has private virtualized hardware: own kernel, a network card, disk, graphics adapter, etc. Since it has its own virtualized hardware, the virtual server will act completely on its own.
Because of KVM maintains separate instances for each virtual server it uses significantly more resources than OpenVZ form a host perspective. in overhead to create/maintain separate instances for each VM.
The pros with KVM is that all applications should work exactly as on a dedicated server, usability of its own kernel, the flexibility of migrating from virtual machine to dedicated server.
These perks comes with a price, the price of more resources needed for the host, meaning a small performance penalty regarding I/O and CPU.
When choosing between the different virtualization techniques there are no better than the other.
The main question is; what are you going to run on that server?
A web server with mysql and php?
You can go either way, personally I prefer OpenVZ in this case because of the ease with reinstalls.
Go with KVM. With the resources that Java needs, it will cause extra pressure on the host when running OpenVZ which sometimes can be mistaken for abuse. KVM handles the memory better and are therefore preferred.
Backup Server that requires remote attached storage?
KVM is the answer here. Since OpenVZ relies on the hosts kernel you might end up with some modules not being loaded and the provider are not interested in loading them for you. With KVM you have access to your own kernel and can add/remove modules as you like.
OpenVZ wiki: http://openvz.org/Main_Page
KVM wiki: http://www.linux-kvm.org/page/Main_Page