KVM-QEMU Windows Guest Memory Speed

kvm-virtualizationmemoryperformanceqemuwindows-server-2016

How to speed up memory in Windows guest running on KVM-QEMU hypervisor?

The memory speed differs between Ubuntu guest and Windows 2016 Server on the same node quite a lot. Same benchmark tool counts aprox. 20GB on Ubuntu VS 7GB on Windows.

It looks like qemu vs kvm issue, but we can't find what exactly. On the guest we try to install stable and latest drivers from fedora https://docs.fedoraproject.org/en-US/quick-docs/creating-windows-virtual-machines-using-virtio-drivers/ , but did not help.

Here is kvm config file of Windows guest:

<domain type='kvm'>
  <name>instance-00005d22</name>
  <uuid>55f5fde4-6194-4917-9841-a1bcd3ee333d</uuid>
  <metadata>
    <nova:instance xmlns:nova="http://openstack.org/xmlns/libvirt/nova/1.0">
      <nova:package version="13.1.4"/>
      <nova:name>prod</nova:name>
      <nova:creationTime>2018-08-03 18:05:11</nova:creationTime>
      <nova:flavor name="8cpu12288ram0disk">
        <nova:memory>12288</nova:memory>
        <nova:disk>0</nova:disk>
        <nova:swap>0</nova:swap>
        <nova:ephemeral>0</nova:ephemeral>
        <nova:vcpus>8</nova:vcpus>
      </nova:flavor>
      <nova:owner>
        <nova:user uuid="10967f955fd441e6bef5769036c3f99d">prod</nova:user>
        <nova:project uuid="af5ce389933e4e8593a57a2723acf556">prod</nova:project>
      </nova:owner>
    </nova:instance>
  </metadata>
  <memory unit='KiB'>12582912</memory>
  <currentMemory unit='KiB'>12582912</currentMemory>
  <vcpu placement='static'>8</vcpu>
  <cputune>
    <shares>1024</shares>
  </cputune>
  <sysinfo type='smbios'>
    <system>
      <entry name='manufacturer'>OpenStack Foundation</entry>
      <entry name='product'>OpenStack Nova</entry>
      <entry name='version'>13.1.4</entry>
      <entry name='serial'>98d28110-9f41-4dfd-87fe-832263eb7c33</entry>
      <entry name='uuid'>55f5fde4-6194-4917-9841-a1bcd3ee333d</entry>
      <entry name='family'>Virtual Machine</entry>
    </system>
  </sysinfo>
  <os>
    <type arch='x86_64' machine='pc-i440fx-xenial'>hvm</type>
    <boot dev='hd'/>
    <smbios mode='sysinfo'/>
  </os>
  <features>
    <acpi/>
    <apic/>
  </features>
  <cpu mode='custom' match='exact'>
    <model fallback='allow'>SandyBridge</model>
    <topology sockets='8' cores='1' threads='1'/>
  </cpu>
  <clock offset='utc'>
    <timer name='pit' tickpolicy='delay'/>
    <timer name='rtc' tickpolicy='catchup'/>
    <timer name='hpet' present='no'/>
  </clock>
  <on_poweroff>destroy</on_poweroff>
  <on_reboot>restart</on_reboot>
  <on_crash>destroy</on_crash>
  <devices>
    <emulator>/usr/bin/qemu-system-x86_64</emulator>
    <disk type='file' device='disk'>
      <driver name='qemu' type='raw' cache='none' io='native'/>
      <source file='/var/lib/nova/mnt/402f76b3e5ec34e746a20f7993575bc8/volume'/>
      <target dev='vda' bus='virtio'/>
      <iotune>
        <read_bytes_sec>314572800</read_bytes_sec>
        <write_bytes_sec>104857600</write_bytes_sec>
        <read_iops_sec>5000</read_iops_sec>
        <write_iops_sec>1000</write_iops_sec>
      </iotune>
      <serial>b4e985c6-a3c6-4b98-a6cc-d5134e39c0de</serial>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/>
    </disk>
    <controller type='usb' index='0'>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'/>
    </controller>
    <controller type='pci' index='0' model='pci-root'/>
    <interface type='bridge'>
      <mac address='fa:16:3e:b5:2b:ef'/>
      <source bridge='qbr75cb72c2-82'/>
      <target dev='tap75cb72c2-82'/>
      <model type='virtio'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
    </interface>
    <serial type='file'>
      <source path='/var/lib/nova/instances/55f5fde4-6194-4917-9841-a1bcd3ee333d/console.log'/>
      <target port='0'/>
    </serial>
    <serial type='pty'>
      <target port='1'/>
    </serial>
    <console type='file'>
      <source path='/var/lib/nova/instances/55f5fde4-6194-4917-9841-a1bcd3ee333d/console.log'/>
      <target type='serial' port='0'/>
    </console>
    <input type='tablet' bus='usb'/>
    <input type='mouse' bus='ps2'/>
    <input type='keyboard' bus='ps2'/>
    <graphics type='vnc' port='-1' autoport='yes' listen='0.0.0.0' keymap='en-us'>
      <listen type='address' address='0.0.0.0'/>
    </graphics>
    <video>
      <model type='cirrus' vram='16384' heads='1'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/>
    </video>
    <memballoon model='virtio'>
      <stats period='10'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x05' function='0x0'/>
    </memballoon>
  </devices>
</domain>

Here is kvm config file of Ubuntu guest:

<domain type='kvm' id='149'>
  <name>instance-00005d06</name>
  <uuid>dbed8335-8e32-4bb2-9351-363ce277a57c</uuid>
  <metadata>
    <nova:instance xmlns:nova="http://openstack.org/xmlns/libvirt/nova/1.0">
      <nova:package version="13.1.4"/>
      <nova:name>test-RAM</nova:name>
      <nova:creationTime>2018-08-16 13:45:22</nova:creationTime>
      <nova:flavor name="4cpu4ram0disk">
        <nova:memory>4096</nova:memory>
        <nova:disk>0</nova:disk>
        <nova:swap>0</nova:swap>
        <nova:ephemeral>0</nova:ephemeral>
        <nova:vcpus>4</nova:vcpus>
      </nova:flavor>
      <nova:owner>
        <nova:user uuid="00ec5fdd6b0f474d891064d9204b88c0">test</nova:user>
        <nova:project uuid="ce9822c178a54f5c8861863c16c63f71">test</nova:project>
      </nova:owner>
    </nova:instance>
  </metadata>
  <memory unit='KiB'>4194304</memory>
  <currentMemory unit='KiB'>4194304</currentMemory>
  <vcpu placement='static'>4</vcpu>
  <cputune>
    <shares>4096</shares>
  </cputune>
  <resource>
    <partition>/machine</partition>
  </resource>
  <sysinfo type='smbios'>
    <system>
      <entry name='manufacturer'>OpenStack Foundation</entry>
      <entry name='product'>OpenStack Nova</entry>
      <entry name='version'>13.1.4</entry>
      <entry name='serial'>b0e243c1-af25-4452-8918-c0a6252bfdec</entry>
      <entry name='uuid'>dbed8335-8e32-4bb2-9351-363ce277a57c</entry>
      <entry name='family'>Virtual Machine</entry>
    </system>
  </sysinfo>
  <os>
    <type arch='x86_64' machine='pc-i440fx-xenial'>hvm</type>
    <boot dev='hd'/>
    <smbios mode='sysinfo'/>
  </os>
  <features>
    <acpi/>
    <apic/>
  </features>
  <cpu mode='custom' match='exact'>
    <model fallback='allow'>SandyBridge</model>
    <topology sockets='4' cores='1' threads='1'/>
  </cpu>
  <clock offset='utc'>
    <timer name='pit' tickpolicy='delay'/>
    <timer name='rtc' tickpolicy='catchup'/>
    <timer name='hpet' present='no'/>
  </clock>
  <on_poweroff>destroy</on_poweroff>
  <on_reboot>restart</on_reboot>
  <on_crash>destroy</on_crash>
  <devices>
    <emulator>/usr/bin/qemu-system-x86_64</emulator>
    <disk type='file' device='disk'>
      <driver name='qemu' type='raw' cache='none' io='native'/>
      <source file='/var/lib/nova/mnt/7f4d8d40da6ef9b1ee9e42ff24b0fbd5/volume'/>
      <backingStore/>
      <target dev='vda' bus='virtio'/>
      <serial>f6f17210-2a88-41ff-955f-c890de3b3425</serial>
      <alias name='virtio-disk0'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/>
    </disk>
    <controller type='usb' index='0'>
      <alias name='usb'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'/>
    </controller>
    <controller type='pci' index='0' model='pci-root'>
      <alias name='pci.0'/>
    </controller>
    <interface type='bridge'>
      <mac address='fa:16:3e:69:b2:d0'/>
      <source bridge='qbr5b46df7d-e7'/>
      <target dev='tap5b46df7d-e7'/>
      <model type='virtio'/>
      <alias name='net0'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
    </interface>
    <serial type='file'>
      <source path='/var/lib/nova/instances/dbed8335-8e32-4bb2-9351-363ce277a57c/console.log'/>
      <target port='0'/>
      <alias name='serial0'/>
    </serial>
    <serial type='pty'>
      <source path='/dev/pts/1'/>
      <target port='1'/>
      <alias name='serial1'/>
    </serial>
    <console type='file'>
      <source path='/var/lib/nova/instances/dbed8335-8e32-4bb2-9351-363ce277a57c/console.log'/>
      <target type='serial' port='0'/>
      <alias name='serial0'/>
    </console>
    <input type='tablet' bus='usb'>
      <alias name='input0'/>
    </input>
    <input type='mouse' bus='ps2'/>
    <input type='keyboard' bus='ps2'/>
    <graphics type='vnc' port='5901' autoport='yes' listen='0.0.0.0' keymap='en-us'>
      <listen type='address' address='0.0.0.0'/>
    </graphics>
    <video>
      <model type='cirrus' vram='16384' heads='1'/>
      <alias name='video0'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/>
    </video>
    <memballoon model='virtio'>
      <stats period='10'/>
      <alias name='balloon0'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x05' function='0x0'/>
    </memballoon>
  </devices>
  <seclabel type='dynamic' model='apparmor' relabel='yes'>
    <label>libvirt-dbed8335-8e32-4bb2-9351-363ce277a57c</label>
    <imagelabel>libvirt-dbed8335-8e32-4bb2-9351-363ce277a57c</imagelabel>
  </seclabel>
</domain>

Thanks for help.

Best Answer

you know that assignment of vcpu isn't really allocating physical vcpu? it's only ammount of passthroughs in cpu cycle. Hope you see where I'm getting with it - first issue I see about "performance" would be your line with both machines - " 4096 " your ubuntu machine have 4 times more.