KVM網絡性能測試(1)

測試結論

  • kvm使用virtio虛擬網卡,網絡小包處理能力損失近半。

測試過程

測試場景

  • 共16臺服務器:其中15臺用做壓測客戶端,1臺被測試。
  • 測試工具使用 Ngrinder ,測試 Tengine 的狀態頁面。
  • 用相同的測試方法:
  1. 測試物理機的網絡性能(8C/32G)
tps = 118,065.1
mtt = 49.42
錯誤率 = 0.01%
虛擬用戶 = 6000
  1. 分別測試1臺虛擬機的網絡性能(4C/4G、4C/8G)
tps = 50,356.2 、 48,976.7
mtt = 72.01 、 79.74
錯誤率 = 1.52% 、 1.38%
虛擬用 戶= 6000、6000
  1. 提升1臺虛擬機的配置再測試(8C/8G)
tps = 50,399.8
mtt = 28.03
錯誤率 = 2.91%
虛擬用戶 = 6000
  1. 同時測試2臺虛擬機的網絡性能(4C/4G + 4C/8G)
tps = 60,554.6
mtt = 40.39
錯誤率 = 1.88%
虛擬用戶 = 6000

測試結果

  • 5萬tps時:pps/in = 260k , pps/out = 160k
    測試結果
  • 宿主機 TPS近12萬,虛擬機最高才 6萬。性能損失了一半!

測試環境

  • 宿主機爲華碩組裝機,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 kvm-net-perfmon:
<domain type='kvm' id='7'>
  <name>kvm-net-perfmon</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='4' threads='1'/>
  </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='/kvm/kvm-net-perfmon.qcow2'/>
      <backingStore type='file' index='1'>
        <format type='raw'/>
        <source file='/kvm/template/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'>
      <source bridge='br0'/>
      <target dev='vnet1'/>
      <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>
相關文章
相關標籤/搜索