
AIX万兆网卡性能测试与优化最佳实践.docx
17页AIX 万兆网卡性能测试与优化最佳实践 导言万兆网卡在当前数据中心环境中使用已经非常普遍千兆网卡时代,通常网络的主要瓶颈是网卡带宽而在万兆网卡时代,网络瓶颈往往是每秒钟处理包数,即Packets Per Second (PPS)尤其是常见的OLTP负载,通常是小数据包为主,对于这类场景,在达到万兆网卡带宽瓶颈之前,往往可能已经达到PPS瓶颈了PPS瓶颈主要受限于目前TCP/IP协议栈的实现方式,根本性的优化方向主要是:1.采用polling轮询机制代替中断机制进行数据包处理;2.减少内核态操作,将网络数据包直接交付到应用层基于这两种优化思路目前市场上已经有一些技术和产品,但相对而言实施复杂度会有明显增加本文通过参数调优与测试,验证在 AIX 平台上万兆网卡的 Packets Per Second (PPS) 极限性能;预计完成优化后,能满足绝大多数业务负载对网络PPS的要求从本案例中的测试结果看,#EN0S网卡在仅使用单万兆口的情况下,能达到至少280万 PPS的性能指标;在使用EtherChannel的情况下,能达到380 PPS而#EN16网卡在仅使用单万兆口的情况下,能达到206万 PPS。
本文中的测试主要使用netperf工具完成同时也使用某厂商的分布式应用进行了验证,得到的网络PPS指标与netperf基本一致测试环境硬件配置:System Model: IBM,9119-MMEMachine Serial Number:Processor Type: PowerPC_POWER8Processor Implementation Mode: POWER 7Processor Version: PV_7_CompatNumber Of Processors: 12Processor Clock Speed: 4190 MHzCPU Type: 64-bitKernel Type: 64-bitLPAR Info: 3 netcli01.26.212Memory Size: 81920 MBGood Memory Size: 81920 MBPlatform Firmware level: SC860_056Firmware Version: IBM,FW860.10 (SC860_056)Console Login: enableAuto Restart: trueFull Core: falseNX Crypto Acceleration: Capable and Enabled网卡:# lscfg -vpl ent1ent1 U78CD.001.FZHC336-P1-C1-T1 PCIe2 4-Port Adapter (10GbE SFP+) (e4148a1614109304)PCIe2 4-Port (10GbE SFP+ & 1GbE RJ45) Adapter:FRU Number..................00E2715EC Level....................D77452Customer Card ID Number.....2CC3Part Number.................00E2719Feature Code/Marketing ID...EN0SSerial Number...............Y250NY67FJUHManufacture ID..............98BE9468AB28Network Address.............98BE9468AB28ROM Level.(alterable).......30100150Hardware Location Code......U78CD.001.FZHC336-P1-C1-T1PLATFORM SPECIFICName: ethernetNode: ethernet@0Device Type: networkPhysical Location: U78CD.001.FZHC336-P1-C1-T1共有 3 个客户端以及服务端(本机)采用 #EN0S 卡;还有 2 个客户端采用的 PCIe 一代卡,如下:# lscfg -vpl ent0ent0 U497B.001.DBJS863-P2-C8-T1 Int Multifunction Card w/ SR Optical 10GbE (a219100714100904)Int Multifunction Card w/ SR Optical 10GbE:Network Address.............E41F13D7595CROM Level.(alterable).......0400003260003Hardware Location Code......U497B.001.DBJS863-P2-C8-T1PLATFORM SPECIFICName: ethernetNode: ethernet@0Device Type: networkPhysical Location: U497B.001.DBJS863-P2-C8-T1测试拓扑为简单的 client/server 模式,共 211 、 213 、 215 、 222 、 223 五个客户端通过 netperf ,与 212 服务端(本机)的 netserver 通信。
收发包大小均为 200 字节测试脚本: #!/bin/ksh93#if [ $1 -gt 0 ]; then THREAD=$1else THREAD=1fin=0while ((n<$THREAD))do nohup netperf -t TCP_RR -l 7200 -H 192.168.26.212 -- -r 200,200 & ((n++))done网卡收发队列调整网卡的接收队列(并发中断数)设置是非常关键的并发控制因素,此设置直接影响系统 kernel CPU 使用率与发包速率不同的万兆网卡支持的并发中断数不同,举 #EN0S 为例,最大支持的并发中断数 (queues_rx) 为 7 可以使用如下命令,将 #EN0S 收发队列均改为最大值 (7) 注意不同型号的网卡其收发队列属性名称、最大值也不同,可以通过 lsattr -Rl entX -a queues_rx 查询取值范围;此处的queues_rx应当替换为实际查询到的队列属性名例如:#EN0S 网卡示例:#lsattr -Rl ent0 -a queues_rx1...7 (+1)vnic 网卡示例:注意,在 vnic 环境中队列数名称为 rx_que_num ,#lsattr -Rl ent0 -a rx_que_num1...16 (+1)修改:(注意需要针对物理网卡进行查询修改,而不是针对 EC 聚合网卡修改)#chdev -l ent1 -a queues_rx=7 -a queues_tx=7查询:# lsattr -El ent1|grep queuesqueues_mgt 1 Requested number of management queues Falsequeues_rx 7 Requested number of Rx queues Truequeues_tx 7 Requested number of Tx queues True绑定网卡中断如果需要达到网卡极限性能,可以考虑进行中断绑定。
中断绑定的方法如下查询网卡中断号PCIe 一代卡或更早期的网卡的中断号可以直接通过 lsattr 查询到而 PCIe 二代或以上网卡通常只在 lsattr 中显示基础中断号,实际运行环境中使用的中断号需要通过 entstat 查询而且如果删除网卡重新配置的话,重配后使用的中断号可能会略有差异,需要注意相应调整绑定命令 lsattr -El entXadapter_type ethernet Adapter Type Falsealt_addr 0x000000000000 Alternate Ethernet address Truebar0 0xa3800000 Bus memory address 0 Falsebar1 0xa3000000 Bus memory address 1 Falsebar2 0xa4130000 Bus memory address 2 Falsebusintr 30752 Bus interrupt level False…#entstat -d…Assigned Interrupt Source Numbers:30752 MGT30753 NIC TX,RX30754 NIC TX,RX30755 NIC TX,RX30756 NIC TX,RX30757 NIC TX,RX30758 NIC TX,RX30759 NIC TX,RX确定 CPU 逻辑号# smtctlThis system is SMT capable.This system supports up to 4 SMT threads per processor.SMT is currently enabled.SMT boot mode is not set.SMT threads are bound to the same physical processor.proc0 has 4 SMT threads.Bind processor 0 is bound with proc0Bind processor 1 is bound with proc0Bind processor 2 is bound with proc0Bind processor 3 is bound with proc0proc4 has 4 SMT threads.Bind processor 4 is bound with proc4Bind processor 5 is bound with proc4Bind processor 6 is bound with proc4Bind processor 7 is bound with proc4proc8 has 4 SMT threads.Bind processor 8 is bound with proc8Bind processor 9 is bound with proc8Bind processor 10 is bound with proc8Bind processor 11 is bound with proc8...绑定策略以及原则1. CPU 0 上不要绑中断,原因是在CPU 0进行中断绑定后,无法使用命令直接解除绑定;2.建议使用每个物理 CPU 的第一个逻辑 CPU进行绑定,例如 4, 8, 12.. ( 当前为 SMT 4时)bindintcpu 。
