2007年7月24日 星期二

Linux KVM 虛擬化技術

Linux KVM Virtualization Performance

Published on January 08, 2007 by Michael Larabel.
Page 1 of 4.


For only being a release candidate the Linux 2.6.20 kernel has already generated quite a bit of attention. On top of adding asynchronous SCSI scanning, multi-threaded USB probing, and many driver updates, the Linux 2.6.20 kernel will include a full virtualization (not para-virtualization) solution. Kernel-based Virtual Machine (or KVM for short) is a GPL software project that has been developed and sponsored by Qumranet. In this article we are offering a brief overview of the Kernel-based Virtual Machine for Linux as well as offering up in-house performance numbers as we compare KVM to other virtualization solutions such as QEMU Accelerator and Xen.

What has been merged into the Linux 2.6.20 kernel is the device driver for managing the virtualization hardware. The other component that comprises KVM is the user-space program, which is a modified version of QEMU. Kernel-based Virtual Machine for Linux uses Intel Virtualization Technology (VT) and AMD Secure Virtual Machine (SVM/AMD-V) for hardware virtualization support. With that said, one of the presented hardware requirements to use KVM is an x86 processor with either of these technologies. The respective technologies are present in the Intel Core series and later, Xeon 5000 series and later, Xeon LV series, and AMD's Socket F and AM2 processors.

The Kernel-based Virtual Machine also assigns every virtual machine as a regular Linux process handled by the Linux scheduler by adding a guest mode execution. With the virtual machine being a standard Linux process, all standard process management tools can be used. The KVM kernel component is embedded into Linux 2.6.20-rc1 kernels and newer, but the KVM module can be built on older kernels (2.6.16 to 2.6.19) as well. At this stage, KVM supports Intel hosts, AMD hosts, Linux guests (x86 and x86_64), Windows guests (x86), SMP hosts, and non-live migration of guests. However, still being worked on is optimized MMU virtualization, live migration, and SMP guests. Microsoft Windows x64 does not work with KVM at this time.

Whether you are using a kernel with KVM built-in or loading it as a module, the process for setting up and running guest operating systems is quite easy. After setting up an image (qemu-img will work with KVM) and the KVM kernel component loaded, the modified version of QEMU can be used with the standard QEMU arguments to get you running.


The hardware requirements to use KVM is an x86/x86_64 processor with AMD or Intel virtualization extensions and at least one Gigabyte of system memory to allow for enough RAM for the guest operating system. For our purposes, we had used two dual-core Intel Xeon LV processors with the Linux 2.6.20-rc3 kernel, which was released on January 1, 2007. Below is the rundown of system components used.

Hardware Components
Processor: 2 x Intel Xeon LV Dual-Core 2.00GHz
Motherboard: Tyan Tiger i7520SD S5365
Memory: 2 x 512MB Mushkin ECC Reg DDR2-533
Graphics Card: NVIDIA GeForce FX5200 128MB PCI
Hard Drives: Western Digital 160GB SATA2
Optical Drives: Lite-On 16x DVD-ROM
Cooling: 2 x Dynatron Socket 479 HSFs
Case: SilverStone Lascala LC20
Power Supply: SilverStone Strider 560W
Software Components
Operating System: Fedora Core 6

The benchmarks we had used for comparing the performance was Gzip compression, LAME compilation, LAME encoding, and RAMspeed. The virtualization environments we had used were QEMU 0.8.2 with the kqemu accelerator module, Xen 3.0.3, and finally KVM. We had also compared these virtualized environments against running Fedora Core 6 Zod without any form of virtualization. During the Xen 3.0.3 testing, we had used full virtualization and not para-virtualization. The image size was set to 10GB during the testing process. The operating system used throughout the entire testing process was Fedora Core 6 Zod.














Looking over the virtualization performance results, KVM was not the clear winner in all of the benchmarks. KVM had taken the lead during Gzip compression, but in the other four benchmarks it had stumbled behind Xen 3.0.3. However, both Xen with full virtualization and the Kernel-based Virtual Machine had performed in front of QEMU with the QEMU accelerator in our select benchmarks using dual Intel Xeon LV processors with Intel Virtualization Technology. The benefits of KVM are high performance, stable, no modifications of the guest operating system are necessary, and a great deal of other capabilities (e.g. using the Linux scheduler). Once the Linux 2.6.20 kernel is officially out the door we will proceed with a greater number of KVM benchmarks in various environments including looking at the hardware virtualization performance between AMD and Intel.