TWiki> Virtualization Web>KVM (revision 2)EditAttachPDF

Kernel-based Virtual Machine

KVM is an alternative VMM to Xen that supports full virtualization with Intel VT and AMD SVM hardware. Similarly to HVM (VT and SVM) virtualized Xen, it uses a modified version of Qemu to emulate and virtualize hardware.

KVM compared to Xen

  • Qemu, and, in effect, KVM and HVM Xen, use a particular kind of OS Image to boot a VM, which includes the kernel and a boot sector, similar to a bootable CD. This is different from a paravirt Xen OS image, which only includes the userspace parts of the OS image and is a raw copy of a volume with a root filesystem.
  • In KVM, a VM runs on top of a normal Linux kernel as a normal process. For example, using the 'kill' command on a KVM process kills the VM.
  • There is no logical network between the VMs and the VMM's physical network interface. This can be an advantage or a disadvantage:
    • There is less isolation between VMs and VMM, which can affect stability and security.
    • Network configuration is easier.
    • In terms of performance, it is hard to say if one approach is better than the other, but having a virtual network driver between VMs gives a performance penalty, and direct access to hardware is always faster. In both KVM and Xen it should be possible to bypass the driver domain (dom0 in Xen or the KVM VMM) and, with Xen paravirt, this has already been done, allowing VMs to have direct access to hardware. Bypassing the driver domain, however, is harder to implement in full virtualization (Xen HVM and KVM), although this may be solved with newer virtualization hardware extensions (e.g. VT-d).
    • Since the virtual drivers that Xen exposes to its domains run in a special VM, dom0, there is extra overhead incurred. Each time the virtual drivers in dom0 needs to manage for example multiplexing of a packet from the network driver, the VMM scheduler switches to dom0. Receiving this packet in domU thus incurs two extra context switches:
      • domU -> VMM scheduler -> dom0 -> VMM scheduler -> domU, as opposed to
      • VM -> Linux scheduler -> VM
  • KVM does not yet support SMP in VMs.
  • KVM is in the vanilla Linux 2.6.20 kernel and can be patched against older kernels. The source code profile of KVM is less intrusive on the kernel source and should be more easy to backport to older versions of Linux.
  • KVM relies on the availability of VT or SVM hardware extensions of x86 CPUs, which should be available in most new PC computers.

Performance

The benchmark results below are not as good as some other results found http://www.phoronix.com/scan.php?page=article&item=623&num=1 and http://linux.inet.hr/finally-user-friendly-virtualization-for-linux.html, some of which show that KVM in certain cases performs better than Xen.

Some benchmark results:

CPU: time factor 3546946890454528713

Native:
real 0m4.858s
user 0m4.336s
sys 0m0.032s

KVM:
real 0m7.076s
user 0m6.980s
sys 0m0.014s

IO: dd if=/dev/zero of=test bs=1M count=1000
time dd if=test of=testout

Native:
real 0m12.159s
user 0m0.740s
sys 0m10.829s

KVM:
real 8m21.899s
user 0m2.549s
sys 0m47.874s

KVM CPU performance: 69 %

KVM I/O performance: 23 %

-- Main.hbjerke - 02 Feb 2007

Edit | Attach | Watch | Print version | History: r5 < r4 < r3 < r2 < r1 | Backlinks | Raw View | Raw edit | More topic actions...
Topic revision: r2 - 2007-02-05 - HenrikHemmestadBjerke
 
    • Cern Search Icon Cern Search
    • TWiki Search Icon TWiki Search
    • Google Search Icon Google Search

    Virtualization All webs login

This site is powered by the TWiki collaboration platform Powered by PerlCopyright & 2008-2020 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback