▷ kernel态单核数据包(64B)处理能力为2Mpps
▷ 2Mpps是因为kernel态瓶颈是2Mpps,如果通过dpdk走用户态,则可以大于2M,原因:收包端要将数据包中断平衡到不同的cpu上,方法:可以通过多队列方式,把每个队列分配到单独cpu上(irqbalance会自动均衡),然后source ip不一样,就会对应到不同队列,也就是不同的中断上。即1个VF,2个队列,VM有至少2核,那么当符合负载均衡条件(mac、ip不同),则理论上最大可以达到4Mpps
更多测试结果:
以下测试使用的packet大小为64B
▷ kernel态,3层转发性能:发包器使用不同的source ip
▪ BCM57800:2Mpps
▪ Intel X520:10Mpps
▪ Intel X710:12Mpps
▷ kernel态,2层转发性能:发包器使用不同的source mac
▪ BCM57800:2Mpps
▪ Intel X520:7.3Mpps
▪ Intel X710:7.8Mpps
▷ kernel态下vxlan封装能力
▪ vxlan内层使用不同的source ip发包
▪ 收包在:1.1-1.2Mpps
▷ dpdk用户态,2层转发性能:发包器使用不同的source ip
▪ BCM57800:不支持
▪ Intel X520:14.8Mpps
▪ Intel X710:14.8Mpps
▷ SR-IOV模式
▪ X520总量11.2Mpps,每vm为11.2Mpps/vm总数(即VF数)
总结:
▷ kernel态下的中断平衡的依据因素:2层依据source mac,3层依据source ip
▷ kernel态下使用传统中断模式的单核转发能力极限2Mpps
注意:
▷ kernel态下,利用多队列RSS中断平衡提升吞吐率,会导致cpu非常高
▷ 用户态下即使source mac或source ip固定,吞吐率基本接近限速14.8Mpps
▷ vxlan不能利用多核来提升吞吐,主要原因为外层source ip不够多
到网卡官网下载对应驱动并安装,经测试,win2012默认就有82599(x520)驱动,但版本旧
13. 运维命令 # 查看网卡支持的vf数量 cat /sys/bus/pci/devices/0000:41:00.0/sriov_totalvfs # 宿主屏蔽VF驱动后查看vf和pf的对应 https://github.com/intel/SDN-NFV-Hands-on-Samples/blob/master/SR-IOV_Network_Virtual_Functions_in_KVM/listvfs_by_pf.sh 载下来后执行./listvfs_by_pf.sh即可 # 宿主屏蔽VF后查看哪些VF正在被使用 yum install dpdk-tools dpdk-devbind --status # 查看网卡对应哪个socket lstopo-no-graphics # lspci查看网卡信息 lspci -Dvmm|grep -B 1 -A 4 Ethernet # 宿主上查看具体VF流量(仅支持x520,x710查不到) ethtool -S p1p1 | grep VF 14. 宿主屏蔽VF驱动 echo "blacklist ixgbevf" >> /etc/modprobe.d/blacklist.conf表示当物理机启动时候,默认不加载ixgbevf驱动,但是如果手动modprobe ixgbevf,则也会加载驱动。
如果当前已经加载了ixgbevf,想卸载,则需要如下步骤
echo 0 > /sys/bus/pci/devices/0000:41:00.0/sriov_numvfs rmmod ixgbevf echo 63 > /sys/bus/pci/devices/0000:41:00.0/sriov_numvfs 附. 包转发率测试方法modprobe pktgen:发包通过pktgen来发,收包通过sar -n DEV来看,发的是udp包
#!/bin/bash NIC="eth1" DST_IP="192.168.1.2" DST_MAC="52:54:00:43:99:65" modprobe pktgen pg() { echo inject > $PGDEV cat $PGDEV } pgset() { local result echo $1 > $PGDEV result=`cat $PGDEV | fgrep "Result: OK:"` if [ "$result" = "" ]; then cat $PGDEV | fgrep Result: fi } # Config Start Here ----------------------------------------------------------- # thread config # Each CPU has own thread. Two CPU exammple. We add ens7, eth2 respectivly. PGDEV=/proc/net/pktgen/kpktgend_0 echo "Removing all devices" pgset "rem_device_all" echo "Adding ${NIC}" pgset "add_device ${NIC}" # device config # delay 0 means maximum speed. CLONE_SKB="clone_skb 1000000" # NIC adds 4 bytes CRC PKT_SIZE="pkt_size 64" # COUNT 0 means forever COUNT="count 0" DELAY="delay 0" PGDEV=/proc/net/pktgen/${NIC} echo "Configuring $PGDEV" pgset "$COUNT" pgset "$CLONE_SKB" pgset "$PKT_SIZE" pgset "$DELAY" pgset "dst ${DST_IP}" pgset "dst_mac ${DST_MAC}" # Time to run PGDEV=/proc/net/pktgen/pgctrl echo "Running... ctrl^C to stop" pgset "start" echo "Done" # Result can be vieved in /proc/net/pktgen/eth[3,4]▷ 将脚本开头的eth1改为发包对应的网卡
▷ 将脚本开头的192.168.1.2改为目标ip
▷ 将脚本开头的52:54:00:43:99:65改为目标mac
pktgen-dpdk
# 固定ip固定mac set 0 dst ip 192.168.10.240 set 0 src ip 192.168.10.245/24 set 0 dst mac c8:1f:66:d7:58:ba set 0 src mac a0:36:9f:ec:4a:28 # 可变source ip可变source mac stop 0 range 0 src ip 192.168.0.1 192.168.0.1 192.168.200.200 0.0.0.1 range 0 dst ip 10.1.1.241 10.1.1.241 10.1.1.241 0.0.0.0 range 0 dst mac c8:1f:66:d7:58:ba c8:1f:66:d7:58:ba c8:1f:66:d7:58:ba 00:00:00:00:00:00 range 0 src mac a0:36:9f:ec:4a:28 a0:36:9f:ec:4a:28 a0:36:9f:ec:ff:ff 00:00:00:00:01:01 range 0 src port 100 100 65530 1 range 0 dst port 100 100 65530 1 range 0 size 64 64 64 0 enable 0 range enable 0 latency start 0 # 按50%的速率发包 set 0 rate 50 附. 参考文档 # openstack关于sriov的限制 https://docs.openstack.org/mitaka/networking-guide/config-sriov.html # 迁移 https://wenku.baidu.com/view/d949db67998fcc22bcd10dfd.html https://www.chenyudong.com/archives/live-migrate-with-pci-pass-through-fail-with-libvirt-and-qemu.html # sriov配置 https://access.RedHat.com/documentation/en-us/red_hat_enterprise_linux/6/html/virtualization_host_configuration_and_guest_installation_guide/sect-virtualization_host_configuration_and_guest_installation_guide-sr_iov-how_sr_iov_libvirt_works # 线速