# KVM vs Xen for the end-user



## vpsnewb (Jun 14, 2013)

As someone who uses VPSes but are still kind of new to them, what is the difference for the end user between KVM and Xen?

I know OpenVZ is used a lot, though it's often oversold (a little or a lot), but I know a lot of people prefer KVM and Xen though too. Aside from typically costing the end user more what can the end user expect from both of them? Trying to see which platform benefits the end user more than the provider.


----------



## jhadley (Jun 14, 2013)

The main one is that you have a full OS and kernel. It uses more space, but you can customise it to your liking, load your own modules etc.


----------



## TheLinuxBug (Jun 14, 2013)

KVM and XEN are forms of full virtualization which have access to their own kernel instead of sharing the kernel with the node. OpenVZ is not full virtualization, it is more of an over glorified jailed environment that has the ability to limit your resource usage and give you root level access to your jailed environment.   KVM is full virtualization which means you can actually choose your own kernel to run.  Xen-HVM is almost the same as KVM as you can choose your own kernel to run, but depending on the configuration you can get better performance out of KVM than Xen-HVM.  There is also Xen-PV which is still Xen but you use a pre-selected kernel for your instance which you can't directly change (it is part of the template you choose).  You still enjoy the full separation of your resources and the ability to use your own kernel modules, however you can not change the kernel that is in use.  For users wishing to setup drive encryption or use kernel modules which are not usually provided in OpenVZ (NFS, FUSE, ipcontrack,etc) XEN/KVM options will allow you to also load your own kernel modules. A lot of the modules are usually not available on OpenVZ because of the shared kernel and potential for it to cause issues for other customer.   In OpenVZ you have no file privacy (beyond trusting the node operator) as you share your data storage space (usually on a single partition) with all other users.  The node operator is able to see all your files without even entering your instance, as all you files are stored in your directory under the storage volume and can be seen from the node.   It is still possible under Xen-pv for the node operator to see your data if they enter your server or mount your drive partition outside your server.  KVM/Xen-HVM this is true as far as being able to mount your drive outside the instance, however, when you install your instance, if you install an distribution that supports it, you can encrypt your whole drive making it so without the key your data can not be seen..

There are other things as well, but these are the biggest of them. I hope this helps.

Cheers!


----------



## qps (Jun 20, 2013)

Xen-PV can use its own kernel.  See pygrub.


----------



## kaniini (Jun 20, 2013)

qps said:


> Xen-PV can use its own kernel.  See pygrub.


Actually the best practice here is to use PV-GRUB to avoid arbitrary execution in the domain-0 environment.  PV-GRUB safely loads and executes the VPS kernel inside it's own domain instead of running python code in domain-0 to copy it out to a temporary location.


----------



## wlanboy (Jun 20, 2013)

Both support full virtualization. So it is all about your favourit flavour.

Both do their jobs reaaly good if your provider knows how to manage them.

I do prefer KVM because it is build in the Linux  kernel. You can create a KVM server out of any Linux pc/laptop.


----------



## concerto49 (Jun 20, 2013)

Considering that it's about the end user and not the host - then not much. All the features etc is up to the host to workaround / deal with etc mostly. XEN HVM vs KVM that is and both being full virtualization.


----------



## shovenose (Jun 21, 2013)

I prefer KVM both from the customer side and the provider side.


----------



## Marc M. (Jun 21, 2013)

I work with both and I like both. They are both awesome.


----------



## biplab (Jun 21, 2013)

vpsnewb said:


> I know OpenVZ is used a lot, though it's often oversold (a little or a lot), but I know a lot of people prefer KVM and Xen though too. Aside from typically costing the end user more what can the end user expect from both of them? Trying to see which platform benefits the end user more than the provider.


Overselling on OpenVZ is as easy as typing-


vzctl set 100 --ram 4T --save
I tried this command in a machine with 4GB ram and it instantly changed guest ram to 4 TeraBytes.

Both of them are great when it comes to Full virtualization. However when it comes to Para-virtualization Xen is the best option.

I installed OpenVZ on my OVH-CA Atom server (which doen't have hvm support). However the experiece was horrible. You can't do this or do that. Later I installed Xen on it. Now I have installed 3 guests which are running great.

They all run with their distro provided kernel. I can use it as a fully virtualized machine linux box where I have no restriction. Now I don't need to crack my head to do simple things like installing a loop device (which is kindof impossible on OpenVZ).

From my experience, go for Xen / KVM wherever possible. Use OpenVZ when you are aware of it's limitations.


----------



## kaniini (Jun 22, 2013)

Overselling Xen and KVM is possible too -- KVM with UltraKSM patch and Xen with a work in progress KSM patch.  But, I think it is not very likely that people will apply the KSM patch to Xen.  There is also feature in Xen 4 called xenpaging, which allows domain-0 to provide swap files to Xen.  This could also be used for overselling.

Ultimately it comes down to whether you trust your host to not oversell.

For example, I would expect a $15/year 128mb anything to be oversold to complete hell, personally.


----------

