HowTo: Choose your VPS plan
Posted: Wed Aug 15, 2012 11:34 pm
Hello again !
We do have a short explanation about virtualization techniques however, the questions run deeper than that.
I intend to give you all information I can think of in this tutorial. It will have 3 parts:
1. Virtualization type;
2. Capacity needed;
3. Operating system.
This first part is in this post.
At this moment, the market presents us with a few choices:
1. Container type virtualization (not really a virtualization, more like isolation): OpenVZ and vServer.
2. Paravirtualization: Xen-PV and VMware.
3. Full virtualization: KVM, Xen-HVM.
Container type virtualization
This means that the containers (your VPSes) are not really virtual machines, but a collection of programs running in an isolated part of the bigger machine. Imagine a big computer which gives you a share of the disk, a share of the memory, a share of the network transfer and takes care that your neighbours will not interfere in your "yard".
This technique has some advantages:
1. Because there is only one kernel (operating system) taking care of everything, it is very fast.
2. The fact that can, in theory, run many containers, means that you can have a smaller price.
It has some disadvantages:
1. Isolation is not the best. Access from main machine is trivial. Also, an abusive container can impact relatively easy the whole node.
2. It is not really stable and the constant adding of features introduces many bugs. This means that nodes are often unstable and when problems occur it is not easy to troubleshoot.
3. Memory is allocated somewhat erratic, OVZ machines show more memory in use than normal to the containers.
4. The form of "virtualization" means that network interfaces (in principal) are not present, as such, special software devices are created (TUN/TAP) to emulate them in order to allow some network functions. This means a lot of things will not work, some VPNs (those based on IPSec), some java apps, many other things.
You should be able to run without problems any webserver that doesn't use Java, ftp, databases, etc, all needed for a regular hosting. It is fast also, so ideal for hosting, if we dont enter in the Java realm.
Java USUALLY works, minecraft is known to work, freenet, many java apps, BUT, they might fail with cryptic error messages. Sometimes adding another CPU core might help, sometimes it won't work in any situation.
It is usually best to check before if your specific application will work or not with OVZ.
vServer is less common and even less compatible as many add-ons that took OVZ closer to a real virtualization are not implemented.
Paravirtualization
This is much closer to a real computer.
It has good isolation, it presents to the guest operating system (your VPS) emulated hardware devices such as network cards and recently even USB. However, the guest operating system (kernel) knows it is running in a virtual machine and is cooperating with the host passing to it the heavylifting of "day-to-day" activities. Especially disk and network access (those that matter the most in a VPS).
As such, it has the benefit of a full virtual machine combined with the speed of a container, since most operations are done in the host kernel at native speed.
Unfortunately, this means that the guest kernel must be modified to know how to cooperate with the host. in linux we can do that easily because the kernel source code is publicly available and we can modify it as we please as long as we know how to do it (specialists only, this is deeply specialized code). Windows code is not publicly available and we should wait for Uncle Bill to do that and he won't, at least for now. So windows cannot run in such an environment, as well as other closed source operating systems.
Full virtualization
This is the most complex of all and uses the most resources to present to the guest operating system (your VPS) a "real" "physical" machine, with hardware such as emulated processor, network card, usb, video card, keyboard, mouse, display, memory, etc.
The operating system does not know it is running in a container in a bigger computer, as far as it is concerned, it has a bios and everything else a real computer has. Sure, some software producers can look at hardware and recognize that it is emulated by model, for example if the processor says qemu, they know there is no such processor maker and it must be an emulated one.
This is happening in KVM and in Xen-HVM, mainly.
It is inherently slow and it takes a lot of processor power to do every simple operation, for example, to send a byte through the network, the "fake" cpu receives an interrupt from the "fake" network card and send a byte from the "fake" memory to it, the "fake" network card is writing it to the "fake" "outside" network, through the "fake" wire etc.
All those "fakes" along the line take a lot of processing power from the host to emulate. I calls huge blocks of code, needs reading from ram/cache/even disk and slows down a lot everything.
Sure, the first fully virtualized environments (anyone remembers BOCHS read "box"? ) were extremely slow, the computers were also very slow at the time, so booting a DOS machine was taking minutes.
There were many improvements, both to the virtualization code as well as the computers themselves (especially CPU matters) and the full virtualization today can produce not only usable, but really snappy virtual machines, if the hardware is right and not oversold.
In particular, the VirtIO drivers developed by redhat for network and disk are reintroducing the Xen-PV concept of the guest kernel cooperating with the host one for intensive operations at another level. The guest is not really aware, but the virtualized interfaces (virtual disk interface and virtual network card) are only gateways to the host which takes over and does the work. Since the code runs with a lower priority, it will never be as fast as Xen-PV, but it is close. This is why it is of paramount importance to use these drivers in our KVM machines, it does make a lot of difference regarding the speed, especially when we use swap or similar frequently, without virtio disk drivers, our VPS will crawl.
Advantages:
1. Full virtualization. Whatever runs on a real computer, will run in a KVM/Xen-HVM VPS, with the exception of those that perform special checks for this (very few games to prevent cheating perhaps something else too with copy prevention schemes).
2. Very good isolation, you have all resources for you alone (that doesnt mean they can't be oversold, but only what you don't use CAN(*) used by others) and if you decide to encrypt your filesystem, it will be very hard for the admins to read it, not to mention outsiders.
3. Runs Windows :0
Disadvantages:
1. Without the VirtIO drivers it is much slower than Xen-PV, not to mention container type virtualization.
2. Needs good hardware and there can't be too many on a node, this means a seriously higher price.
Speed is like this:
1. Container type-almost full native speed. Usually faster than real hardware you may have because it can benefit from faster disk arrays that regular users can't afford as well as the huge processing power that is not normally used in a well balanced node (not oversold).
2. Xen-PV. About 20% overhead, it can vary a lot depending on implementation, but still seriously slower than container type.
3. KVM, Xen-HVM have about same speed relative to each other but they have about 10% more penalty regarding Xen-PV, with special drivers and much worse without.
I will continue this regarding capacity needed for typical scenarios.
Admin
(*) If the hosting company allows this, Prometeus does not apply this technique to sell more resources than the node has, in fact leaves some space for emergencies and maintenance work.
We do have a short explanation about virtualization techniques however, the questions run deeper than that.
I intend to give you all information I can think of in this tutorial. It will have 3 parts:
1. Virtualization type;
2. Capacity needed;
3. Operating system.
This first part is in this post.
At this moment, the market presents us with a few choices:
1. Container type virtualization (not really a virtualization, more like isolation): OpenVZ and vServer.
2. Paravirtualization: Xen-PV and VMware.
3. Full virtualization: KVM, Xen-HVM.
Container type virtualization
This means that the containers (your VPSes) are not really virtual machines, but a collection of programs running in an isolated part of the bigger machine. Imagine a big computer which gives you a share of the disk, a share of the memory, a share of the network transfer and takes care that your neighbours will not interfere in your "yard".
This technique has some advantages:
1. Because there is only one kernel (operating system) taking care of everything, it is very fast.
2. The fact that can, in theory, run many containers, means that you can have a smaller price.
It has some disadvantages:
1. Isolation is not the best. Access from main machine is trivial. Also, an abusive container can impact relatively easy the whole node.
2. It is not really stable and the constant adding of features introduces many bugs. This means that nodes are often unstable and when problems occur it is not easy to troubleshoot.
3. Memory is allocated somewhat erratic, OVZ machines show more memory in use than normal to the containers.
4. The form of "virtualization" means that network interfaces (in principal) are not present, as such, special software devices are created (TUN/TAP) to emulate them in order to allow some network functions. This means a lot of things will not work, some VPNs (those based on IPSec), some java apps, many other things.
You should be able to run without problems any webserver that doesn't use Java, ftp, databases, etc, all needed for a regular hosting. It is fast also, so ideal for hosting, if we dont enter in the Java realm.
Java USUALLY works, minecraft is known to work, freenet, many java apps, BUT, they might fail with cryptic error messages. Sometimes adding another CPU core might help, sometimes it won't work in any situation.
It is usually best to check before if your specific application will work or not with OVZ.
vServer is less common and even less compatible as many add-ons that took OVZ closer to a real virtualization are not implemented.
Paravirtualization
This is much closer to a real computer.
It has good isolation, it presents to the guest operating system (your VPS) emulated hardware devices such as network cards and recently even USB. However, the guest operating system (kernel) knows it is running in a virtual machine and is cooperating with the host passing to it the heavylifting of "day-to-day" activities. Especially disk and network access (those that matter the most in a VPS).
As such, it has the benefit of a full virtual machine combined with the speed of a container, since most operations are done in the host kernel at native speed.
Unfortunately, this means that the guest kernel must be modified to know how to cooperate with the host. in linux we can do that easily because the kernel source code is publicly available and we can modify it as we please as long as we know how to do it (specialists only, this is deeply specialized code). Windows code is not publicly available and we should wait for Uncle Bill to do that and he won't, at least for now. So windows cannot run in such an environment, as well as other closed source operating systems.
Full virtualization
This is the most complex of all and uses the most resources to present to the guest operating system (your VPS) a "real" "physical" machine, with hardware such as emulated processor, network card, usb, video card, keyboard, mouse, display, memory, etc.
The operating system does not know it is running in a container in a bigger computer, as far as it is concerned, it has a bios and everything else a real computer has. Sure, some software producers can look at hardware and recognize that it is emulated by model, for example if the processor says qemu, they know there is no such processor maker and it must be an emulated one.
This is happening in KVM and in Xen-HVM, mainly.
It is inherently slow and it takes a lot of processor power to do every simple operation, for example, to send a byte through the network, the "fake" cpu receives an interrupt from the "fake" network card and send a byte from the "fake" memory to it, the "fake" network card is writing it to the "fake" "outside" network, through the "fake" wire etc.
All those "fakes" along the line take a lot of processing power from the host to emulate. I calls huge blocks of code, needs reading from ram/cache/even disk and slows down a lot everything.
Sure, the first fully virtualized environments (anyone remembers BOCHS read "box"? ) were extremely slow, the computers were also very slow at the time, so booting a DOS machine was taking minutes.
There were many improvements, both to the virtualization code as well as the computers themselves (especially CPU matters) and the full virtualization today can produce not only usable, but really snappy virtual machines, if the hardware is right and not oversold.
In particular, the VirtIO drivers developed by redhat for network and disk are reintroducing the Xen-PV concept of the guest kernel cooperating with the host one for intensive operations at another level. The guest is not really aware, but the virtualized interfaces (virtual disk interface and virtual network card) are only gateways to the host which takes over and does the work. Since the code runs with a lower priority, it will never be as fast as Xen-PV, but it is close. This is why it is of paramount importance to use these drivers in our KVM machines, it does make a lot of difference regarding the speed, especially when we use swap or similar frequently, without virtio disk drivers, our VPS will crawl.
Advantages:
1. Full virtualization. Whatever runs on a real computer, will run in a KVM/Xen-HVM VPS, with the exception of those that perform special checks for this (very few games to prevent cheating perhaps something else too with copy prevention schemes).
2. Very good isolation, you have all resources for you alone (that doesnt mean they can't be oversold, but only what you don't use CAN(*) used by others) and if you decide to encrypt your filesystem, it will be very hard for the admins to read it, not to mention outsiders.
3. Runs Windows :0
Disadvantages:
1. Without the VirtIO drivers it is much slower than Xen-PV, not to mention container type virtualization.
2. Needs good hardware and there can't be too many on a node, this means a seriously higher price.
Speed is like this:
1. Container type-almost full native speed. Usually faster than real hardware you may have because it can benefit from faster disk arrays that regular users can't afford as well as the huge processing power that is not normally used in a well balanced node (not oversold).
2. Xen-PV. About 20% overhead, it can vary a lot depending on implementation, but still seriously slower than container type.
3. KVM, Xen-HVM have about same speed relative to each other but they have about 10% more penalty regarding Xen-PV, with special drivers and much worse without.
I will continue this regarding capacity needed for typical scenarios.
Admin
(*) If the hosting company allows this, Prometeus does not apply this technique to sell more resources than the node has, in fact leaves some space for emergencies and maintenance work.