Digital Edition

SYS-CON.TV
Virtualization Comes in More than One Flavor
Emulation, paravirtualization, operating system-level virtualization

When you think about virtualization, you probably think about VMware, or maybe Xen, and hopefully, even OpenVZ. With all the buzz surrounding this space, I thought it time to discuss three of the four different types of virtualization: emulation, paravirtualization, operating system-level virtualization, and multi-server (cluster) virtualization. The last is outside the scope of this article.

Each virtualization type has pros and cons that impact its appropriate application.

Emulation makes it possible to run any non-modified operating system that supports the platform being emulated. Implementations in this category range from pure emulators (like Bochs) to solutions that let some code to be executed on a real CPU natively, or by patching the code during runtime - to increase performance. The main disadvantages of emulation are low performance and low density. Examples: VMware products, QEmu, Bochs, Parallels.

Paravirtualization is a technique used to run multiple modified operating systems on top of a thin layer called a hypervisor, or virtual machine monitor. Paravirtualization has better performance than emulation, but the disadvantage is that the "guest" OS has to be modified. Examples: Xen, UML.

Operating system-level virtualization enables multiple isolated execution environments in a single operating system kernel. It has the best possible (i.e., close to native) performance and density, and features dynamic resource management. On the other hand, this technology can't run different kernels from different operating systems at the same time. Examples: FreeBSD Jail, Solaris Zones/Containers, Linux-VServer, OpenVZ, Virtuozzo.

Let's examine the concept of Virtual Environments (VE, also known as VPS, containers, partitions, etc.), which is an isolated program execution environment and (from the point-of-view of its owner) looks and feels like a separate physical server. A VE has its own set of processes starting from init, file system, users (including root), network interfaces with IP addresses, routing tables, firewall rules (netfilter/iptables), etc.

Multiple VEs can co-exist on a single physical server. While different VEs can run different Linux distributions, all VEs operate under the same kernel.

Now, let's look more closely at the OpenVZ kernel, which is a modified Linux kernel that adds virtualization and isolation of various subsystems, resource management, and checkpointing.

Virtualization and isolation enable many virtual environments within a single kernel. The resource management subsystem limits (and in some cases guarantees) resources, such as CPU, RAM, and disk space on a per-VE basis. Checkpointing is the process of "freezing" a VE, saving its complete state to a disk file, with the ability to "restore" that state later.

Resource management is of paramount importance for operating system-level virtualization technology, because there's a finite set of resources within a single kernel that are shared among multiple Virtual Environments. All those resources need to be controlled in a way that lets many VEs co-exist on a single system and not impact each other.

The OpenVZ resource management subsystem consists of three components:

  1. Two-level disk quota - The OpenVZ server administrator can set per-VE disk quotas in terms of disk space and number of inodes. This is the first level of disk quota. The second level of disk quota lets the VE administrator (VE root) use standard Unix quota tools to set per-user and per-group disk quotas.
  2. "Fair" CPU scheduler - The OpenVZ CPU scheduler is also two levels. On the first level it decides which VE to give the time slice to, taking into account the VE's CPU priority and limit settings. On the second level, the standard Linux scheduler decides which process in the given VE to give the time slice to, using standard process priorities.
  3. User Beancounters - This is a set of per-VE counters, limits, and guarantees. There's a set of about 20 parameters that are carefully chosen to cover all the aspects of VE operation so no single VE can abuse any resource that is limited for the whole computer and thus do harm to other VEs. The resources accounted and controlled are mainly memory and various in-kernel objects such as IPC shared memory segments, network buffers, etc.
Checkpointing allows for the "live" migration of a VE to another physical server. The VE is "frozen" and its complete state is saved to a disk file. This file can then be transferred to another machine and the VE can be "unfrozen" (restored) there. The whole process takes a few seconds, and from the client's point of view it looks like a delay in processing, not downtime, since the established network connections are also migrated.

OpenVZ Utilities
OpenVZ comes with a vzctl utility, which implements a high-level command-line interface to manage Virtual Environments. For example, to create and start a new VE takes just two commands - vzctl create and vzctl start.

To change various VE parameters, the vzctl set command is used. Note that all the resources (for example, VE virtual memory size) can be changed during runtime. This is either impossible or difficult to implement in other virtualization technologies like emulation or paravirtualization.

Templates
Templates are pre-created images used to create a new VE. A template is a set of packages, and a template cache is an archive (tarball) of a chrooted environment with those packages installed. This tarball is unpacked during the vzctl create stage. Using a template cache technique, a new VE can be created in seconds, enabling fast deployment scenarios.

Vzpkg tools are a set of tools to facilitate template cache creation. It currently supports RPM- and yum-based repositories. For example, to create a template of Fedora Core 5 distribution, one needs to specify a set of (yum) repositories that have FC5 packages, and a set of packages to be installed.

Pre- and post-install scripts can also be employed to optimize/modify a template cache further. All the data above (like repositories, lists of packages, scripts, and GPG keys) form template metadata. With template metadata, the vzpkgcache utility can automatically create a template cache . It will download and install the listed packages into a temporary VE, and pack the result as a template cache. Template caches for non-RPM distributions can be created too, although it's more of a manual process.

Usage Scenarios
The following usage scenarios are common for all virtualization technologies. However, a unique feature of OS-level virtualization like OpenVZ is that there isn't much overhead penalty to pay, which makes the scenarios more appealing.

Server consolidation allows an organization to decrease the number of physical servers it uses by moving its applications into virtual environments; the number of operating system environments remains the same. This saves hardware costs, rack space, electricity, and management efforts.

Security can be drastically improved by putting each network service (like Web server, mail server, etc.) into a separate isolated Virtual Environment. If there's a security hole in one of the applications, the others aren't affected. The ability to manage resources dynamically and migrate live applications is an added bonus.

Software development and testing - Developers and testers usually need access to a handful of Linux distributions, and they need to reinstall them from scratch a lot. Using virtualization, developers can operate multiple distributions at native performance using a single server without having to reboot; a new virtual environment can be created in just a minute. Cloning a VE is also simple.

Educational - Each student can have a VE and play with different Linux distributions. A new VE can be (re)created in a minute.

Summary
Hopefully, that gives you a better understanding of the different types of Linux virtualization technology, especially, operating system-level virtualization and the OpenVZ open source implementation.

The OpenVZ project is freely distributed and offers support to its users, promoting operating system virtualization through a collaborative community effort. Supported by SWsoft, the OpenVZ project serves the needs of community developers, testers, documentation experts, and other technology enthusiasts who wish to participate in and accelerate the technology development process. OpenVZ is the open source software used as the basis of Swsoft's Virtuozzo virtualization software.

The OpenVZ project is actively working to incorporate operating system-level virtualization in the mainstream Linux kernel. Some progress has been made with the latest pre-patch for the stable Linux kernel tree, 2.6.19-rc1, including some contributions from OpenVZ, IBM, and Eric Biederman. This is an ongoing initiative.

About Kirill Kolyshkin
Kirill Kolyshkin was named leader and project manager for the OpenVZ project in 2005 to further the adoption of operating system (OS)-level server virtualization. He spearheads the overall development and manages all key architecture, updates and feature upgrades for OpenVZ. Kolyshkin has more than 10 years Linux experience and has long been an active open source advocate. His 15-years career experience includes positions in information technology at Deutsche Bank and telecommunications company, Severtelecom. He holds a degree in Computer Science from the Ukhta State Technical University.

In order to post a comment you need to be registered and logged in.

Register | Sign-in

Reader Feedback: Page 1 of 1



ADS BY GOOGLE
Subscribe to the World's Most Powerful Newsletters

ADS BY GOOGLE

As DevOps methodologies expand their reach across the enterprise, organizations face the daunting ch...
As Marc Andreessen says software is eating the world. Everything is rapidly moving toward being soft...
ChatOps is an emerging topic that has led to the wide availability of integrations between group cha...
You know you need the cloud, but you’re hesitant to simply dump everything at Amazon since you know ...
Is advanced scheduling in Kubernetes achievable?Yes, however, how do you properly accommodate every ...
The cloud era has reached the stage where it is no longer a question of whether a company should mig...
The need for greater agility and scalability necessitated the digital transformation in the form of ...
In his keynote at 18th Cloud Expo, Andrew Keys, Co-Founder of ConsenSys Enterprise, provided an over...
Coca-Cola’s Google powered digital signage system lays the groundwork for a more valuable connection...
In his session at 21st Cloud Expo, Raju Shreewastava, founder of Big Data Trunk, provided a fun and ...
While some developers care passionately about how data centers and clouds are architected, for most,...
"Since we launched LinuxONE we learned a lot from our customers. More than anything what they respon...
DevOps is under attack because developers don’t want to mess with infrastructure. They will happily ...
"As we've gone out into the public cloud we've seen that over time we may have lost a few things - w...
In his session at 21st Cloud Expo, Michael Burley, a Senior Business Development Executive in IT Ser...
Sanjeev Sharma Joins June 5-7, 2018 @DevOpsSummit at @Cloud Expo New York Faculty. Sanjeev Sharma is...
We are given a desktop platform with Java 8 or Java 9 installed and seek to find a way to deploy hig...
"I focus on what we are calling CAST Highlight, which is our SaaS application portfolio analysis too...
"Cloud4U builds software services that help people build DevOps platforms for cloud-based software a...
The question before companies today is not whether to become intelligent, it’s a question of how and...