We have all experienced this. Another solution to this problem would be to install the new production server on new hardware, but this is not as easy, as you have to clone the first server (most people are not confortable doing this) or you do not have the hardware.

+

We have all experienced this. Another solution to this problem would be to install the new production server on new hardware, but this is not as easy, as you have to clone the first server (most people are not comfortable doing this) or you do not have the hardware.

Using vserver, all this is very easy

Using vserver, all this is very easy

Revision as of 21:42, 18 September 2006

For many people, virtual server may look like a great toy: Very high geekness factor. It looks cool, but probably not for everyone. Wrong!

Contents

Usage scenarios

Consolidation and Seperation

As the hardware evolves, it is tempting to put more and more tasks on a server. Linux can handle it. Linux is reliable and so on. At some point, you end up with so much stuff and so many people fiddling in the same box that you worry about updating things.

Vservers address this. The same box runs multiple vservers and each one does the job it is supposed to do. If you need to upgrade to php5 for a given project you do so and only that project is affected.

Also, you can give the root password of a vserver to one administrator and he will be able to perform updates, restart services and so on without having to know about every other project hosted on a server.

Resource Independance

Since vservers are only guests on the hardware they are using, they are not aware of the specifics: They do not contain disk configurations, kernels or network configurations.

Once you have found that a project is using more resource than expected, you can move it to another box without having to fiddle here and there. A vserver is just a directory inside the host server. You tar it and copy it to another box and restart it there.

An administrator can move vservers around without his users knowing what he does.

Experimenting and Upgrading

You have this typical problem. You intend to upgrade a site either with new package (new PHP5) or new features (new version of the Web applications). After having tested all this on the development machine, you are ready to update the production server. Having some experience you do it properly

First a good backup of the server

Then you perform all the upgrades and install the new applications

Fire: the new server is online and kicking.

2 hours later, you realise that something does not work as expected.

To make it worse, it works fine on the development machine.

Now it is 2 am and this has to work by 8am. Hum.

We have all experienced this. Another solution to this problem would be to install the new production server on new hardware, but this is not as easy, as you have to clone the first server (most people are not comfortable doing this) or you do not have the hardware.

Using vserver, all this is very easy

You stop the production vserver

You clone it (Cloning a vserver takes 1 minute unless it has a lot of data).

You perform the upgrades in the new vserver and give it life.

Later you find it does not work as expected and you can't immediately fix it.

You turn off the new vserver and assign it a new IP number.

You start both the old and new. Now the old is still online and you can fiddle with the new (on a different IP address) to fix the problem.

Development and Testing

You are working on a new project. At this point you have no idea of the resources it will need (load). In general, you have a meeting and make a decision about the new hardware. But in this case we have no idea. So instead, we put the new project on a vserver on the first available linux box, including the workstation of the developer. And we develop. Once the thing is ready, we clone the vserver on some production server and give it a go.

Later once we know how popular the new service is, we can move it again to a more powerful server, as needed, without any fiddling (moving accounts, installing packages, and so on)

As a good example, Herbert has 33 vservers on his notebook allowing him to test various projects and various distributions from rh6.2 to FC3 and Debian.

Distribution Independence

We are often talking about our preferred distribution. Should we use FC, Debian or something else ? Should we give a spin to the latest and greatest ?

With vservers, the choice of a distribution is less important. When you select a distribution, you expect it will do the following

Good hardware support/detection

Good package technology/updates

Good package selection

Reliable packages

The choice is important because every service running on a box will be using the same distribution. Most distributions out there are good and reliable. But they have flaws. For example, a distribution - say XXX - is great but is not delivering the latest and greatest PHP. Now because you have decided to use XXX for some projects, it does not prevent you from using XXY for other projects. So instead of moving to XXY for everything, you move to it as you see fit, project per project.

Other considerations

Virtual Private Servers are running on the same kernel as the host: Unlike other VM solutions, vservers don't require additional memory or processing power.

There are no special daemons running: A vserver running crond, sshd, httpd and sendmail uses the same resources as a normal Linux server running these services.

No pre-allocated disk space needed: Vservers generally share the disk space with the host, so there is no need to pre-allocate disk space for each vserver only to find out later that your disk is full, yet each vserver is only using of tiny portion of their allocated space.

Resource sharing: Since vservers can share binaries and libraries without interfering, a second vserver generally cost 40-100 megs of disk space only. Most of this space is a copy of the packaging database.

Independent updates: Vservers are updated independently even if they share binaries with other vservers.