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.
Introduction
OpenVZ
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
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.
Summary
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.
Java?
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.
Bibliography
OpenVZ wiki: http://openvz.org/Main_Page
KVM wiki: http://www.linux-kvm.org/page/Main_Page
Is there any difference between xen and kvm?
Yes there is, I am currently writing up something about the difference between KVM and Xen.
Keep your eyes open, you can subscribe to the rss feed, twitter or like the facebook page to get noticed when something new is published.
Good website! I really love how it is simple on my eyes and the data are well written. I’m wondering how I might be notified when a new post has been made. I’ve subscribed to your RSS feed which must do the trick! Have a nice day!
I just want to mention I am all new to weblog and certainly liked your website. Likely I’m likely to bookmark your blog . You really come with perfect stories. Thanks for revealing your webpage.
Good work, keep it up.
I will gladly admit that this is one of the best introductory sites for new bees like myself. It was a great help to me as it gave a clear idea about the topic. I am not a stranger to the subject any more thanks to your hard labor and patience as you have done a great job creating this blog. Thank you for your contribution to the fact.
Hi,
thanks for the info. Would KVM be more suitable for a game server (Team Fortress 2)?
Regards,
George.
KVM would be more suitable when you need access to kernel modules and/or modified kernels.
Some things are not available in openvz.
I’m still pretty new to this so I don’t think I’m anywhere close modifying kernel moduels, but I went with RamNode’s CKVM and so far I can’t complain.