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 efficiently 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 our Server admimistrators on if we can add modules to the kernel. Some may not be added due to security concerns.
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.