如何加快在 KVM-QEMU 管理程序上运行的 Windows 客户机的内存速度?
同一节点上的 Ubuntu 客户机和 Windows 2016 Server 之间的内存速度差别很大。同一基准测试工具计算得出 Ubuntu 上内存约为 20GB,而 Windows 上内存约为 7GB。
这看起来像是 qemu 与 kvm 的问题,但我们找不到具体是什么。在客户机上,我们尝试安装来自 fedora 的稳定和最新的驱动程序https://docs.fedoraproject.org/en-US/quick-docs/creating-windows-virtual-machines-using-virtio-drivers/,但没有帮助。
以下是 Windows 客户机的 kvm 配置文件:
<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>
这里是 Ubuntu 客户机的 kvm 配置文件:
<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>
感谢帮助。
答案1
您知道 vcpu 的分配实际上并不是分配物理 vcpu 吗?它只是 cpu 周期中的直通量。希望您明白我的意思 - 我看到的关于“性能”的第一个问题是您的两台机器的行 - “4096”您的 ubuntu 机器有 4 倍多。