Optimal settings for win7 64 guest on kvm 64 host managed with libvirt

kvm-virtualizationlibvirtwindows 7

I am using libvirt to control kvm on a fairly new (core i3) host running Debian Squeeze amd64.
The Host as well as Linux guests work and feel fast and responsive.
Simply installing Win7 with virt-manager standard profile for windows7 takes forever. I mainly blame the disk io, but Windows generally does not seem as responsive as linux guests.

Do you have some hints regarding performance optimal settings for Win7 guests on kvm?

(Sorry for the many dumps, but I think they are good as a point of reference.)

Host Konfiguration:

kvm: Version: 1:0.12.5+dfsg-5+squeeze8
libvirt-bin: Version: 0.8.3-5+squeeze2

virsh dumpxml:

<domain type='kvm' id='27'>
  <name>win7-template</name>
  <uuid>a4eb05fa-0d4e-5ced-2ff1-e15507795d1b</uuid>
  <memory>2097152</memory>
  <currentMemory>2097152</currentMemory>
  <vcpu>2</vcpu>
  <os>
    <type arch='x86_64' machine='pc-0.12'>hvm</type>
    <boot dev='hd'/>
  </os>
  <features>
    <acpi/>
    <apic/>
    <pae/>
  </features>
  <clock offset='localtime'/>
  <on_poweroff>destroy</on_poweroff>
  <on_reboot>restart</on_reboot>
  <on_crash>restart</on_crash>
  <devices>
    <emulator>/usr/bin/kvm</emulator>
    <disk type='file' device='disk'>
      <driver name='qemu' type='raw'/>
      <source file='/var/lib/libvirt/images/win7-template.img'/>
      <target dev='hda' bus='ide'/>
      <alias name='ide0-0-0'/>
      <address type='drive' controller='0' bus='0' unit='0'/>
    </disk>
    <disk type='file' device='cdrom'>
      <driver name='qemu' type='raw'/>
      <source file='/var/lib/libvirt/images/isos/de_windows_7_professional_with_sp1_x64_dvd.iso'/>
      <target dev='hdc' bus='ide'/>
      <readonly/>
      <alias name='ide0-1-0'/>
      <address type='drive' controller='0' bus='1' unit='0'/>
    </disk>
    <controller type='ide' index='0'>
      <alias name='ide0'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x1'/>
    </controller>
    <interface type='network'>
      <mac address='52:54:00:af:89:f2'/>
      <source network='default'/>
      <target dev='vnet2'/>
      <alias name='net0'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
    </interface>
    <serial type='pty'>
      <source path='/dev/pts/5'/>
      <target port='0'/>
      <alias name='serial0'/>
    </serial>
    <console type='pty' tty='/dev/pts/5'>
      <source path='/dev/pts/5'/>
      <target type='serial' port='0'/>
      <alias name='serial0'/>
    </console>
    <input type='tablet' bus='usb'>
      <alias name='input0'/>
    </input>
    <input type='mouse' bus='ps2'/>
    <graphics type='vnc' port='5902' autoport='yes'/>
    <video>
      <model type='vga' vram='9216' heads='1'/>
      <alias name='video0'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/>
    </video>
    <memballoon model='virtio'>
      <alias name='balloon0'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/>
    </memballoon>
  </devices>
</domain>

cat /proc/cpuinfo (snippet)

processor   : 3
vendor_id   : GenuineIntel
cpu family  : 6
model       : 37
model name  : Intel(R) Core(TM) i3 CPU         540  @ 3.07GHz
stepping    : 2
cpu MHz     : 3058.386
cache size  : 4096 KB
physical id : 0
siblings    : 4
core id     : 2
cpu cores   : 2
apicid      : 5
initial apicid  : 5
fpu     : yes
fpu_exception   : yes
cpuid level : 11
wp      : yes
flags       : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx rdtscp lm constant_tsc arch_perfmon pebs bts rep_good xtopology nonstop_tsc aperfmperf pni dtes64 monitor ds_cpl vmx est tm2 ssse3 cx16 xtpr pdcm sse4_1 sse4_2 popcnt lahf_lm arat tpr_shadow vnmi flexpriority ept vpid
bogomips    : 6117.86
clflush size    : 64
cache_alignment : 64
address sizes   : 36 bits physical, 48 bits virtual

Best Answer

  1. Use virtio for disks and network.
  2. for the mountpoint where you keep the images and the isos, use the noatime and nodiratime options
  3. use the deadline scheduler on the host
  4. use spice/qxl for video for proper video performance