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>

转载于:https://my.oschina.net/anglix/blog/597218

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值