Virtualization, Paravirtualization, whatever you say!?!?

Άρθρο από Lefteris Karafilis Wed, 10/11/2010 - 12:07

It’s time to move on! It’s time to understand what is virtualization and why you need it. I know, it’s complicated to feel comfortable with something you don’t know, with something so complicated. But here you are reading my blog post and that means that you are considering the technology, that you care about understanding the definitions, the benefits and the technology behind virtualization.

What is virtualization

When people talk about virtualization they usually mean hardware virtualization. Although it is not the only form of virtualization, it’s the most widespread. In hardware virtualization, either hosted or hypervisor (bare metal),  a number of individual O/S instances encapsulated as virtual machines to run on a single computer, dynamically partitioning and sharing available physical resources as CPU, storage and I/O devices.

Most users are familiar with products like VMWare workstation, MS Virtual PC and windows XP emulation mode which are a form of platform virtualization with hosted architecture. In hosted architecture the virtualization layer is installed as an application on top of an operating system (like windows, unix, linux, etc). This configuration has great flexibility in terms of hardware compatibility because of the presence of the host operating system.

In a hypervisor architecture the virtualization layer is installed directly to the hardware platform thus it is more reliable, scalable and robust. Because of the absence of the host operating system, hypervisor architecture works on limited certified hardware. Products with hypervisor architecture include VMware ESX, VSphere, Microsoft Hyper-V, Sun xVM, wind river, etc.

In both methods virtual machines are abstracted from the underlying hardware; in simple terms the guest O/S does not understand that  it runs in a virtual environment. This achieved by the virtualization layer which is responsible for the abstraction, sharing and partitioning of the CPU, memory and I/O devices.

Comparison of virtualization methods

Hardware virtualization was a great challenge to achieve because operating systems are designed to directly interact with bare-metal hardware. Virtualization vendors had to develop a strategy in which the O/S could be hosted in a virtual environment. And they came up with 3 different methods:

Binary Translation

In binary translation the virtualization layer sits at CPU privilege level 0 (most privileged). The Guest O/S system were supposed to run on level 0, but since virtual layer occupies that level, it moves guest O/S execution at privilege level 1 and leaves user applications at level 3 as it supposed to be.  The non-virtualizable kernel code of the guest O/S is translated by virtual layer into new sequences of instructions that have the intended effect on virtual hardware, while user level code is directly executed on the CPU for high performance. The benefit of this approach is that the O/S is fully abstracted from the underlying hardware thus it doesn’t require any modification.

Hardware Assisted

In hardware assisted virtualization the virtual layer sits in a new root mode privilege level under level 0. Guest O/S privileged and sensitive calls are set to auto trap to the hypervisor while user request are executed directly to the CPU for high performance. Hardware assisted virtualization requires a compatible CPU like intel VT-x and AMD’s AMD-V to work. This technique is not performing as expected because of the high overhead between guest O/S-to-hypervisor transition. On the other side hardware assisted virtualization is the future and we are expecting to see improved performance in next generation releases. At this moment this technique is utilized in specific cases by vendors like VMware such as for 64-bit guest support on Intel Processors. O/S is still fully abstracted from the underlying hardware thus it doesn’t require any modification.

Paravirtualization

In paravirtualization the Guest O/S kernel is modified to provide a special API that can be used by the virtual layer to translate non-virtualizable instructions with hypercalls. Virtualization layer interacts directly with guest O/S thus its lower virtualization overhead and better performance, though it can vary depending on the workload. Since paravirtualization requires kernel modification it is not suited for O/S like MS windows which kernel cannot be modified. Also in production environments deep kernel modification is a matter of question since it introduces significant support and maintability issues.

Paravirtualization is used in many cases by vendors in conjunction with binary or hardware assisted technique to provide better performance. Example of this are VMtools which are a set of drivers and tools that allow virtual layer to interact with Guest O/S for better performance and manageability but not in the CPU level.

image image image

  Binary Translation Hardware Assisted Paravirtualization
Guest O/S modification Unmodified Unmodified Modified
Compatibility Excellent Excellent Poor
Performance Good Fair (will be improved in next generations) Good
Vendors Vmware , Microsoft, Parallels Vmware, Microsoft, Parallels, Xen Vmware, Xen

Benefits of virtualization

Ok with all this technical jargon. Why should someone consider going to virtualization? Here are some benefits:

  1. You can run one or more applications that are not supported by the Host O/S
  2. Better security and isolation, since malfunctions or malware infection of a guest O/S does not affect the others
  3. Peace of cake creation of test environments
  4. Easy cloning of virtual machines on the same physical hardware or across servers
  5. Snapshot technique which enables you to revert back to a specific point in time. Especially useful in case of configuration changes and service pack and patches malfunctions.
  6. Excellent recovery scenarios if you backup in VM level. Since VMs are abstracted from hardware you can easily move/restore them to new physicals servers without complications
  7. Better utilize hardware resources. VM management software allows you to configure hardware to virtual resource partitioning and utilization. For example you can set specific CPU thresholds, memory allocation, disk space allocation, I/O structures, etc. Also you can let the virtual machine monitor to decide the resources allocation according to utilization.
  8. Reduce physical space consumption and reduce hardware costs. You have fewer servers to buy.
  9. Benefit from the licensing models many O/S vendors as Microsoft are providing. For example, if you buy Windows 2008 ENT edition you get licenses for 4 virtual machines.

Final Thoughts

There are many virtualization products out there (you can find a comparison list here) and hardware virtualization is not the only form of virtualization. You can virtualize applications (application virtualization), operating systems (O/S virtualization without guest VMs), storage, etc.

You can use a wide variety of tools to monitor and manage your virtual machines. Some of these are generic while others are vendor specific, like Vcenter for managing VMware products and Microsoft Operations Manager to manage Microsoft products. There are tools like Microsoft’s Disk2VHD and Vmware’s Vcenter Converter to let you easily convert and migrate physical servers to virtual machines and believe me, it is relatively easy to do so in most cases. Major backup software vendors like Symantec Backup Exec and Ca’s Brightstor have enabled their products to be compatible with virtualization platforms (mostly with VMware and Microsoft) to let you backup guest O/S at both data level or VM level. 

There is already a great installation base at SMB and Enterprise level and technology maturity is considerable. Virtualization is definitely the future and there are many benefits to consider.