KVM網絡性能測試(3)

測試結論

  • 開啓虛擬機的VCPU綁定後,網絡小包處理性能上升約 13% 、相對物理機性能損耗約 45%
    總體結果

測試過程

  1. 測試宿主機的小包處理性能,以Tengine的狀態頁面爲例
  2. 測試默認狀況下kvm虛擬機的小包處理性能,單獨測試、兩臺同時測試
  3. 綁定vcpu後測試kvm虛擬機的小包處理性能,單獨測試、兩臺同時測試

測試結果

宿主機

  1. 單獨測試宿主機(QPS=118,668.8)
    宿主機

測試虛擬機默認配置

  1. 單獨測試虛擬機一(QPS=44,267.4)
    虛擬機1
  2. 單獨測試虛擬機二(QPS=44,524.1 )
    虛擬機2
  3. 同時測試虛擬機一和虛擬機二,資源爭搶嚴重(st%)(QPS=57,909.7)
    虛擬機1+2

綁定虛擬機vcpu

  1. 虛擬機1綁定前4顆vcpu後(QPS=43,031.7)
    虛擬機1綁vcpu
  2. 虛擬機2綁定後4顆vcpu後(QPS=46,448.2 )
    虛擬機2綁vcpu
  3. 同時測試虛擬機1和虛擬機2分別綁定vcpu,資源爭搶明顯緩解(st%)(QPS=65,287.4)
    虛擬機1+2綁vcpu

綁定vcpu的方法

  • 默認狀態virsh vcpuinfo T-web-demo1 :
VCPU:           0
CPU:            2
State:          running
CPU time:       18.0s
CPU Affinity:   yyyyyyyy
VCPU:           1
CPU:            1
State:          running
CPU time:       3.5s
CPU Affinity:   yyyyyyyy
VCPU:           2
CPU:            1
State:          running
CPU time:       3.6s
CPU Affinity:   yyyyyyyy
VCPU:           3
CPU:            6
State:          running
CPU time:       3.4s
CPU Affinity:   yyyyyyyy
  • 給每一個核分配一個指定的cpu:
virsh vcpupin T-web-demo-1 0 0
virsh vcpupin T-web-demo-1 1 1
virsh vcpupin T-web-demo-1 2 2
virsh vcpupin T-web-demo-1 3 3
  • 配置後的狀態virsh vcpuinfo T-web-demo1 :
VCPU:           0
CPU:            0
State:          running
CPU time:       594.9s
CPU Affinity:   y-------
VCPU:           1
CPU:            1
State:          running
CPU time:       476.9s
CPU Affinity:   -y------
VCPU:           2
CPU:            2
State:          running
CPU time:       490.9s
CPU Affinity:   --y-----
VCPU:           3
CPU:            3
State:          running
CPU time:       486.6s
CPU Affinity:   ---y----

測試環境

  • 宿主機爲華碩組裝機,CPU=8核、內存=32G、硬盤=240G-ssd。
  • 壓測機器爲15臺虛擬機,CPU=4核、內存=4G(所在宿主機配置相同,沒有跑其它業務)。
# libvirtd --version
libvirtd (libvirt) 1.2.9
# nginx -v
Tengine version: Tengine/2.1.1 (nginx/1.6.2)
# kvm --version
QEMU emulator version 2.1.2 (Debian 1:2.1+dfsg-12+deb8u4), Copyright (c) 2003-2008 Fabrice Bellard
Intel(R) Xeon(R) CPU E3-1230 V2 @ 3.30GHz * 8
Jessie-8.2 3.16.0-4-amd64 #1 SMP Debian 3.16.7-ckt11-1+deb8u3 (2015-08-04) x86_64 
Ethernet controller: Intel Corporation 82574L Gigabit Network Connection
  • 虛擬機的配置 virsh dumpxml web-demo-1:
<domain type='kvm' id='2'>
  <name>web-demo-1</name>
  <memory unit='KiB'>8388608</memory>
  <currentMemory unit='KiB'>4194304</currentMemory>
  <vcpu placement='static'>4</vcpu>
  <resource>
    <partition>/machine</partition>
  </resource>
  <os>
    <type arch='x86_64' machine='pc-i440fx-2.1'>hvm</type>
    <boot dev='hd'/>
  </os>
  <features>
    <acpi/>
  </features>
  <cpu mode='host-passthrough'>
    <topology sockets='1' cores='2' threads='2'/>
  </cpu>
  <clock offset='utc'/>
  <on_poweroff>destroy</on_poweroff>
  <on_reboot>restart</on_reboot>
  <on_crash>destroy</on_crash>
  <devices>
    <emulator>/usr/bin/kvm</emulator>
    <disk type='file' device='disk'>
      <driver name='qemu' type='qcow2'/>
      <source file='/vm/web-demo-1.qcow2'/>
      <backingStore type='file' index='1'>
        <format type='raw'/>
        <source file='/vm/template/root-jessie-8.2.qcow2'/>
        <backingStore/>
      </backingStore>
      <target dev='vda' bus='virtio'/>
      <iotune>
        <total_iops_sec>200</total_iops_sec>
      </iotune>
      <alias name='virtio-disk0'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
    </disk>
    <controller type='usb' index='0'>
      <alias name='usb0'/>
      <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='11:22:33:00:d4:b2'/>
      <source bridge='br0'/>
      <target dev='vnet0'/>
      <model type='virtio'/>
      <alias name='net0'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x05' function='0x0'/>
    </interface>
    <input type='tablet' bus='usb'>
      <alias name='input0'/>
    </input>
    <input type='mouse' bus='ps2'/>
    <input type='keyboard' bus='ps2'/>
    <graphics type='vnc' port='5900' autoport='yes' listen='0.0.0.0'>
      <listen type='address' address='0.0.0.0'/>
    </graphics>
    <video>
      <model type='cirrus' 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>
  <qemu:commandline>
    <qemu:arg value='-cpu'/>
    <qemu:arg value='host'/>
  </qemu:commandline>
</domain>
相關文章
相關標籤/搜索