Using virtualization to reduce downtime

Before building the production-ready environment that we run today, we had to become virtualization experts. We actually didn’t know back then but I can assure you that knowing virtualization allows you to reduce risks and automate tasks significantly.

Here at Leanservers we have extensive experience with VMware, Xen/Citrix, VirtualBox and OpenVZ; but our favorite beast is undoubtedly OpenVZ.

You can benefit similarly using any other virtualization technologies but OpenVZ is the one that works best for us primarily because of its amazing performance that allows you to run virtual machines at virtually native speeds. Its only limitation fits us perfectly: it can only run Linux OS.

Let me quote the excellent explanation of the different virtualization techniques from OpenVZ.org:

There are several kinds of virtualization techniques which provide similar features but differ in the degree of abstraction and the methods used for virtualization.

1. Virtual machines (VMs)

Virtual machines emulate some real or fictional hardware, which in turn requires real resources from the host (the machine running the VMs). This approach, used by most system emulators, allows the emulator to run an arbitrary guest operating system without modifications because guest OS is not aware that it is not running on real hardware. The main issue with this approach is that some CPU instructions require additional privileges and may not be executed in user space thus requiring a virtual machines monitor (VMM), also called a hypervisor, to analyze executed code and make it safe on-the-fly. Hardware emulation approach is used by VMware products, VirtualBox, QEMU, Parallels and Microsoft Virtual Server.

2. Paravirtualization

This technique also requires a VMM, but most of its work is performed in the guest OS code, which in turn is modified to support this VMM and avoid unnecessary use of privileged instructions. The paravirtualization technique also enables running different OSs on a single server, but requires them to be ported, i.e. they should «know» they are running under the hypervisor. The paravirtualization approach is used by products such as Xen and UML.

3. Virtualization on the OS level, a.k.a. containers virtualization

Most applications running on a server can easily share a machine with others, if they could be isolated and secured. Further, in most situations, different operating systems are not required on the same server, merely multiple instances of a single operating system. OS-level virtualization systems have been designed to provide the required isolation and security to run multiple applications or copies of the same OS (but different distributions of the OS) on the same server. OpenVZ, Virtuozzo, Linux-VServer, Solaris Zones and FreeBSD Jails are examples of OS-level virtualization.

Short comparison

The three techniques differ in complexity of implementation, breadth of OS support, performance in comparison with standalone server, and level of access to common resources. For example, VMs have wider scope of usage, but poorer performance. Para-VMs have better performance, but can support fewer OSs because one has to modify the original OS.
Virtualization on the OS level provides the best performance and scalability compared to other approaches. Performance difference of such systems can be as low as 1…3%, comparing with that of a standalone server. Virtual Environments are usually also much simpler to administer as all of them can be accessed and administered from the host system. Generally, such systems are the best choice for server consolidation of same OS workloads.

So, why using virtualization is so beneficial? Basically it allows you to do a bunch of operations safely, such as:

  • Backup and clone a server without stopping it.- in general, there are ways on most virtualization platforms of doing a full backup of a running machine without stopping it. This is really a piece of cake using OpenVZ and this backup can be spawn as a clone with different name, resource allocation and IP address(es) easily.
  • Creating a checkpoint/snapshot that allows you to revert to it if something bad happens.- one of the most common problems for system administrators across the globe is when and how to update the system; should it be automatically or manually? Supervised or unattended? Virtualization allows you to easily and quickly take a snapshot of a running system that can be reverted to in case an update goes terribly wrong.
  • Add/remove/edit IPs easily with no downtime.- it’s just a pleasure to add/remove IP addresses to a server running OpenVZ: fast,reliable, no service restart required (it’s all done automatically for you).
  • Modify the resource allocation and quotas dynamically.- this is especially useful if, let’s say, you are consolidating servers and are running a monitoring system together with your DNS server and your monitoring system goes crazy and starts eating up all the CPU… Well here is virtualization to rescue you, set limits properly and sleep tight at night knowing that secondary services won’t eat up all the resources letting your main boys starve to death.
  • Faster reboot times.- this might be a OpenVZ specialty but… When you reboot a OpenVZ container it’s way faster than normal since is not that the whole machine is rebooting; only the services need to be restarted, pretty much. You can cut our restart times from minutes to seconds. This is awesome when you need to reboot a machine that’s so critical that cannot go down… So instead of waiting 5 minutes you wait 15 seconds.

Even though all our services run on dedicated servers we use OpenVZ as an extra layer of management to make day to day operations easy, fast and reliable. We need to spawn a new node in Europe? No problem, we clone and relocate. Our mail server needs a critical update? Easy, we just create a checkpoint and troubleshoot. There has been a new critical bug reported on production? Fine, clone the server and run it somewhere else safe an quietly where our techies can take a deep look at it.

Leave a Comment


NOTE - You can use these HTML tags and attributes:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>