Virtualization

From Exterior Memory
Jump to: navigation, search

Terminology

A hypervisor runs on the physical hardware. The hypervisor allocates (hardware) resources to different virtual machines, each containing a guest operating system.

Virtualization Methods

The three main methods of computer host virtualization are:

Virtualization/Emulation
Complete emulation of all hardware. This is slowest. Allows a hypervisor to emulate different a CPU for each guest OS. The big advantage is that it does not require any changes to the host OS or host application.
Paravirtualization
The guest operating system runs on top of a small software API that closely mimics the underlying hardware, albeit in a jail. May be fast. Allows different operating systems to run in the same hypervisor. Requires modification to the guest OS, especially when hardware-assisted virtualization is used.
Operating system-level virtualization
The guest and hypervisor run the same operating system. May be fastest, but also the least flexible. It is not possible to upgrade to OS of a guest VM independently of each other. Requires extensive modifications to the Linux kernel. These changes are no longer available by default in the kernel since Linux 2.6.37.

Example Software and hosters

Emulation VMware, Qemu, Bochs
Paravirtualization Xen, KVM, bhyve, Wind River, Hyper-V?, VirtualBox?
Operating system-level virtualization chroot/jail, Linux VServer, OpenVZ/Virtuozzo, Docker, User Mode Linux.

Amazon uses Xen. Strato uses Virtuozzo.

Hardware-assisted virtualization

The speed of paravirtualization greatly benefits from hardware virtualization. Intel VT-x and AMD-V (both released in 2006) allow the virtualization to run in hardware instead of software. This reduces the overhead and makes paravirtualization for guest OS almost as fast as the hypervisor OS. With Xen, this is know as PV on HVM (or PVHVM): Paravirtualisation on Hardware-assisted Virtualized Machine.

In general, the number of virtual layer should be minimized for best performance. For example, with User Mode Linux (UML) everything is proxied in software, which makes it very slow. On the other hand, OpenVZ or Docker are nearly as fast as native applications, even though -to a user- the virtualization mechanism is the same.

Finally, while paravirtualisation on hardware-assisted virtualization is always faster for disk and network I/O compared to normal paravirtualisation, in some cases memory access may be slightly faster with normal paravirtualisation. So it may pay of to understand virtualisation details, or simply test an application under different virtualisation methods.