IBM is, and has been, a great supporter for KVM. I was quite pleased today to find the following link:
http://publib.boulder.ibm.com/infocenter/lnxinfo/v3r0m0/topic/liaat/liaatbestpractices_pdf.pdf
Nice, easy to read, publication on how to optimize the performance of KVM, complete with a few test results to justify their recommendations.
Thank you IBM!
An update:
Being a bit of a computer efficiency enthusiast (read “speed freak”) I decided to migrate one of my VMs from a .img file base directly to an lvm – bypassing the Linux filesystem overhead as IBM suggests. The process was relatively straight forward, given that I had no issues with the VM being down when I migrated it. I decided to do this for my new Mail VM, since I was going to have to grow the image size anyhow to handle long term storage of e-mail.
1) Create a new logical disk volume: lvcreate -L512G -nmail_vm vg
2) Boot my “recovery” minimal boot image passing it the old image file and the new logical volume
kvm -drive file=mail.img,if=virtio -drive file=/dev/vg/mail_vm,if=virtio,format=raw -cdrom minimal.iso -boot d -curses -no-reboot -m 512 -smp 2
The VM then boots with 2 drives, /dev/vda (old mail.img) and /dev/vdb (new disk). Within the minimal shell, you then:
A) Format the new drive with fdisk /dev/vdb (I create 4 partitions, a 64mb /boot in partition 1, a 1GB swap area in partion 2, at 512mb /root in 3, and an LVM area with the rest of the disk in partition 4)
B) Create a new physical volume group on it via pvcreate /dev/vdb4, a logical volume group on that with vgcreate vg00 /dev/vdb4 and divvy it up as desired with lvcreate commands. Do note that the volume group name you use needs to be different than what is used on the .img drive. Confirm everything looks good with vgs and lvs.
C) Mount the old and new partitions onto new root trees like /or and /nr and use tar to move the files cd or; tar cf – . | (cd /nr; tar xvf -).
D) Install grub on the new drive to make it bootable. This was actually just a bit tricky, the key being to create symbolic links for /dev/hda, /dev/hda1, etc. to their /dev/vda counterparts after which the grub root (hd0,0) and setup (hd0) command worked as normal.
E) Shutdown and start using your new /dev/vg/mail_vm image:
kvm -net nic,model=virtio -net tap,ifname=tap2,script=no -drive file=/dev/vg/mail_vm,if=virtio,boot=on -curses -no-reboot -m 2g -smp 2 -runas kvm -name mail,process=mail-kvm