Linux – KVM / QEmu / Libvirt I/O lockup

kvm-virtualizationlinuxqemuvirtualization

Simple issue. I'm running 5 KVM/QEmu instances. the host machine is constantly freezing for about a half a second in every 5. Disk LED hints that it is disk write related. Host is FC14, guests of FC14/FC15/Windows 7/BSD

The host machine is 100% unresponsive during these small periods. Any kb/mouse input "catches up" after the pause.

Tried using different cache modes in libvirt, different disk types and the issue is constant regardless of the number of guests (though Windows makes it worse, even when paused).

Here is the typical cmd executed by libvirt.

/usr/bin/qemu-kvm -S -M pc-0.13 -cpu phenom,+wdt,+skinit,+osvw,+3dnowprefetch,+misalignsse,+sse4a,+abm,+cr8legacy,+extapic,+cmp_legacy,+lahf_lm,+rdtscp,+pdpe1gb,+popcnt,+cx16,+ht,+vme -enable-kvm -m 2048 -smp 3,sockets=3,cores=1,threads=1 -name devserver -uuid aaa-bbb-ccc-ddd-eee-fff -nodefconfig -nodefaults -chardev socket,id=monitor,path=srv.monitor,server,nowait -mon chardev=monitor,mode=readline -rtc base=utc -boot c -drive file=srv.img,if=none,id=drive-virtio-disk0,boot=on,format=raw -device virtio-blk-pci,bus=pci.0,addr=0x5,drive=drive-virtio-disk0,id=virtio-disk0 -drive file=srv_data.img,if=none,id=drive-ide0-0-0,format=raw -device ide-drive,bus=ide.0,unit=0,drive=drive-ide0-0-0,id=ide0-0-0 -drive file=srv_home.vmdk,if=none,id=drive-virtio-disk1,format=vmdk -device virtio-blk-pci,bus=pci.0,addr=0x7,drive=drive-virtio-disk1,id=virtio-disk1 -device rtl8139,vlan=0,id=net0,mac=aa:bb:cc:dd:ee,bus=pci.0,addr=0x3 -net tap,fd=51,vlan=0,name=hostnet0 -chardev pty,id=serial0 -device isa-serial,chardev=serial0 -usb -device usb-tablet,id=input0 -vnc 127.0.0.1:0 -vga cirrus -device AC97,id=sound0,bus=pci.0,addr=0x4 -device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x6

Any idea as to possible tweaks to help this issue?

Thanks in advance.

Best Answer

this is not your final answer - I would start by looking at disk iops - use tools like iostat and sar (sysstat) - find out what your practical iops are - and check if your swap is busy also

I have seen similar behavior with sata drives in a software raid (md), every time a kvm guest was doing a lot of writes the vm's responsiveness lagged quite a bit. I didnt take the time to tweak, we switched to a raid controller with cache, battery and writeback - still the same drives, that helped a lot - my hunch is the caching of writes was the trick. (that was a single quad xeon with 12GB of ram running 2 windows DC's and 5 small application servers, none was all that busy, used a 3ware 9690).