Page 1 of 1

HowTo: Choose your VPS plan

Posted: Wed Aug 15, 2012 11:34 pm
by Admin
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.

Re: HowTo: Choose your VPS plan

Posted: Fri Aug 17, 2012 10:04 pm
by Admin
What capacity do we need ?

This is not so easy to determine. At times, even the customer doesn't know what will be the level of usage his service will have.
For example he will have no idea how many visitors his blog will have, how many downloads his whitepaper or cat pictures will gather, how many users his VPN service, how much traffic those will need, how many employees will use the webmail, so on and so forth.
We can, obviously, make an educated guess about the maximum possible capacity needed. 100 users, 200, 2000, 5000, 100000...
But how will this translate in RAM, bandwidth needed, disk speed, so on and so forth.
This is hard to estimate because it depends on many factors.
One visitor on a site may stay 5 minutes, see 10 pages, or stay 2 hours and turn 50o pages. Visitors can see a text page and read it or watch some video streams. You may use it for a VPN to read some papers your government is blocking, or to watch BBC or Al-Jazeera live.
You can have a site which is using heavy databases and generate a lot of content out of it, or serve a few static pages.
As you can see, the uses for a VPS (even tho we detail only a few here) are very diverse and need various resources in various quantities.
As a general rule, let's take a forum like this one. It uses a database, generates live the content, but does not have much traffic because we have mostly text, no ads, not even pictures (except smilies and a few buttons/avatars). This can be hosted in an 128 MB VPS and 1 GB or hard disk space with 10 GB of traffic... 64 MB is possible, also.
If you want to host your clan's forum, this is enough. If you want to host a forum like phpbb.com, you will need more space, more traffic and more RAM.
How much ? At a first sight, I will say 512 MB ram and 30 GB should be enough. As about traffic, if we count the code downloads, I would say 1-2 TBs at most. It is possible to need more memory, like 1 GB, even more.
The needed memory is a function of how many visitors in the same time your site/VPS has. For example, if you ave 1000 visitors a day, this doesn't say much, but if you have 1000 visitors a day but all in a single minute, your VPS will certainly crumble if it has below 1-2 GB+ ram and not very fast storage. Fortunately, storage is fast enough with Prometeus (the disk will supply the data from the database at an acceptable rate), but memory might not be enough if you didn't plan ahead because every visitor takes a chunk of memory. If, however, all 1000 visitors are spread evenly in 24 hours, then will not be more than a few in the same time. In this situation, 128-192 MB ram will be enough (in theory 64 + 64 swap is enough, but we want to be sure and fast), and any mid-range storage speed will do.

There is also, another question I hear often: Will it matter if my VPS is in US and my audience in Europe ? Will this downgrade my google ratings ? SEO ?
The simple answer is NO to both.
The complex answer is: depends. If you are streaming content (video most important), hosting heavy downloads (over, say 50-100 MB) it may impact performance, as well as increasing ping and lowering somewhat transfer rate for VPNs.
As of what SEO is concerned, no, there is no negative impact.
These are marginal, things, however, the most important ones are price, characteristics and performance. If you have similar near you, sure, choose the closer location. If the main characteristics are better with, let's say, 10% at the furthest location, chose that one. If, in your own country, the characteristics are 20% less, still chose the furthest one, if only 15%, chose the location in your country, because it is likely that local exchange internet is much better than the international band.

There is also a difference between what traffic your VPS has and what bandwidth. For example, if you have 500 GB traffic and in reality you see that more than 0.03 MB/s cant be pulled/pushed at any time, then you will never be able to use the 500 GB. So you can't really compare hosts that offer 500 GB and you can use that in an hour, with hosts where you can only use 500 GB in 5 months, because in the latter case, they do not really offer 500 GB.

There is also a problem with unlimited/unmettered plans on certain port speeds. Usually you will not be able to use that speed, so ask people that use that host about real speeds.

Regarding storage capacity, that is really simple, you know the size of content you will put online, so you need AT LEAST that disk size. In fact you will need more, on some plans much more because you need to leave place for the operating system, panel software, logs, even swap space. Take at least 2 times more if the quantity is small, and add 50-30% as the material grows past 10 or so GB. Users might upload stuff, store emails and such, plan well.

Now, regarding the storage access speed, the famous dd tests... Those are fake indicators, in reality nobody will write a continuous file at speeds more than 10-20 MB/s, if it is downloaded from internet. Network speed will limit it. Sure, it can offer a clue about how fast the storage is, but on certain low memory plans, it will be hindered if you use the standard memory sync.
Prometeus is a leader in access speed, however, it is time to drop that test and use others, such as ioping, that shows the latency with which the storage replies to requests. that is the most important thing, be it in database hosting, gameservers, even very heavily accessed dynamically generated content.
For a normal site with a few concurrent visitors, speeds like 10 MB/s are enough if we talk about DD, and even high iopings like 100-200 ms can be ok, but that kind of iopings show the storage is under high stress and chances of failure are high.

I will give some examples where i round 20-50% up to be sure:

1. personal blog: Wordpress with default plugins and a few hundred visitors a day 128 Ram, 5 GB hard disk, 50 GB bandwidth, openvz is recommended. Plans start from a dollar a month. If you use special blog software and optimized VPS, 50 MB+50 MB swap/vswap will do. Disk space can be lower or higher depending what you are putting there. Double the ram for heavier plugins.
2. Forum site, such as this one with a few hundred hits a day, can be cool in 128 Ram, 4 GB etc. If you double the traffic, for example, doesnt mean we need to double everything, just memory must be increase 10% or so, if we have 10000 visitors in spikes such as 200+ visit the same time, we will need 1 GB+, maybe 2 GB of ram, but not because of the larger number of visitors, but because of the simultaneous visits we get. The other things can remain the same, because this site without huge pictures/movies, etc, doesn't use much traffic or disk storage, after all, visitors don't upload content.
3. Video streaming site. You may think to be closer to your audience int his case, it begins to be needed. If they are too far the video might stop to buffer or stop altogether because the route at one of the many hops along the way, something broke. If you are streaming content to Pakistan from Europe, it might not be a good idea if you have HD video and stuff, but small files will have no problem. Any music or radio, too, will have no problem. In this case you need serious bandwidth if you have tens of connections at a time, you could use up to a few hundred GB a day if video files are large and you have many visitors. It also depends if the video is generated and streamed on the VPS or just downloaded form here and played locally, such as a WMV file in windows media player on the visitor's computer.
If the streams are generated on the VPS, then you need some serious processing power for multiple streams of high quality. I would say, you need some 2-3 GB ram, big storage if files are stored on the VPS, multiple cores, multi-terrabyte traffic.

As you see, the needs vary widely. If you need specific advice, ask us :)

We will continue with the choice of an Operating System below.

Re: HowTo: Choose your VPS plan

Posted: Fri Aug 17, 2012 10:47 pm
by Admin
What Operating System ?

This is not so hard, it usually goes down to personal preference, but at times is important.

64 (amd64) or 32 (x86) bit ?

First, a word about 32 bit vs 64.
If your application NEEDS 64 bit OS or you have more than 3 GB of ram in your VPS, then you have to do with 64. No real choice.
For any other scenario, 32 is preferred. It takes less ram, less disk space and it is possibly faster.

Linux

I will write about Linux first and windows later.
For example, any Linux OS can do hosting, can do streaming, can do VPN, and many other things.
The differences come to how heavy they are and how efficiently are they doing the same task.
Debian.
Pro:
-light and fast;
-heavily tested, probably has the majority of servers out there and packages change rarely so it is very stable also;
-secure, mostly because it is heavily tested and there is a huge team patching known holes.
Cons:
-relatively outdated, many packages were upgraded multiple times since Debian stable got out;
-poor support for many automatisation panels, (most are redhat oriented, even tho there is quite a list of the ones that are designed or work on Debian too)

Ubuntu:
Based on Debian, is more up to date but less tested since much fewer people use it for servers, and if they do, there are many releases during the life of a Debian one.
Pro:
-light and fast (but heavier than Debian);
-up-to-date;
Cons:
-even poorer support for automatization panels, since some that work on Debian need tweaks to work on ubuntu;
-less tested and probably less secure;

Centos:
It has 2 releases in production, those are sometimes radically different in what they can support. Centos 5 is based on RHEL 5 and that was a great release, Redhat was supporting then many things, including Xen and some panels were released for this version and not working on CentOS 6. CentOS is the Community Enterprise OS and is binary compatible with RHEL, only branding removed (sometimes not completely, lol :mrgreen: )
CentOS 5 Pro:
-stable, tested, fast, compatible;
Con:
-Relatively outdated, will sooner or later become unsupported;
-Heavier than Debian.

CentOS 6 Pro:
-Updated, modern, support has been improved for some technologies;
Cons:
-Heavier, support has been withdrawn from some technologies.

Other distributions have more or less one principal characteristic they were developed for, like Tiny Core is very small and fast, for example. In general, Debian and CentOS are the heavylifters here, together with their offspring.

Windows

Though the huge majority of VPSes run Linux (it is normal in a way, Linux does better as a server) there is an important minority of Windows VPSes.
They use normally some Server distribution, with or without GUI, but mostly with.
It is used to host .NET apps, mostly, for remote desktop, by people which don't know Linux, etc.

When we have to use Windows as a VPS, we must consider security and MAKE SURE it has all the updates in order.
The second concern is to choose a plan that will support our app. For example, Windows 2008RC2 Web Edition doesn't support all services the Standard Edition supports. Microsoft has detailed requirements regarding memory/space/cpu etc on their site and while memory and storage space are easy to choose in a plan, CPU is harder. QEMU CPU is an emulated one and it's capacities depend heavily on what the host setup behind the scenes and we must also consider that Windows only runs in full virtualization mode, i.e. only Xen-HVM and KVM currently support it from the most used techniques (Microsoft and VMWare also, as well as others, but you don't see many offers of that kind). This means it uses a lot of resources and it is picky regarding the hardware.
As a result, we use Windows when there is no choice, our apps will not run well on Mono, wine, or when we have no clue in Linux, but we must consider that, at the same size, a Windows VPS will do a much lousier job. A Linux VPS with 512 MB RAM will sustain hundreds of simultaneous hits without buckling, while Windows, taking into consideration the heavier components too (MSSQL, ASP, .NET), will crumble under a lot less visitors, in fact, Microsoft doesn't even recommend installing a server in less than 1 GB RAM.
So, if you have 300 visitors at peak in Linux with 512 RAM, for example, if you have to switch to ASP, make sure you have 3 times those resources, also, that the virtualization will also be heavy, if your Linux was in OVZ, put 4 times the resources in Windows for the same number of visitors to be sure.
In practice, with tweaks and all, will work in less, as we have good servers in 512 MB but this is only because of exceptional hardware and custom made installs, don't take it for granted everywhere.

I hope I gave you a vague idea on how to choose a VPS. If you need more info, ask in our ask a question section. I will update this with relevant observations and things I omitted or forgot.

Admin