KVM under Fedora 9
2008-06-20 21:14KVM is a nice virtualisation program. Unlike the basic Qemu it only works on CPUs with virtualisation instructions. Installation used to be a nightmare, but it's now not bad at all.
# yum install qemu-img kvm
Edit /etc/modprobe.conf, adding:
alias /dev/kvm kvm-intel
or kvm-amd, depeding on what is under the hood.
# depmod
Using a disk image we prepared earlier:
# qemu-kvm -hda disk.cow -m 512
Performance of Qemu for boot and shutdown of CentOS 5. Without KVM:
real 2m58.120s user 2m31.290s sys 0m4.094s
With KVM:
real 1m8.837s user 0m27.603s sys 0m18.641s
As well as the greater elapsed time, look at the proportion of user+sys to real. Qemu alone occupied a CPU for 87% of the time. Qemu with KVM occupied a CPU for 66% of the time. So KVM is about a third more efficient than Qemu alone when both are under high load. This can certainly be felt when using the machines for other tasks as well as running the virtual machine.
KVM is cheap and simple virtualisation, as basic as a Volkswagen Beetle. The sort of thing that's useful when you want to run up a machine to do a test (eg, does my program work on an as-shipped installation) or to build a package for a foreign distribution.
VMWare is better in many ways. Simpler to use, more efficient. But installing VMWare on something other than the supported distributions and versions is a ongoing nightmare of tracking what the kernel folk have changed this week. KVM is in the kernel.org kernel, so that sort of breakage isn't going to happen.