iperf3跑满100G网卡实测记录

在两台服务器之间进行网络性能测试,通过iperf3客户端和服务器端的配置,利用MellanoxConnectX-5100G网卡,展示出稳定的31.4Gbps至36.4Gbps的传输速率,总合并速率接近92GB/s。测试过程中,CPU占用率保持在较低水平,表现出良好的网络传输效率。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

环境准备

拓扑

两台服务器 100G网卡对插直连。

ubuntu20.04, 系统设置默认状态

MTU 1500

网卡

Mellonax ConnectX5 100G

root@vnet:~# lspci | grep Mellanox
98:00.0 Ethernet controller: Mellanox Technologies MT27800 Family [ConnectX-5]
98:00.1 Ethernet controller: Mellanox Technologies MT27800 Family [ConnectX-5]

设置为以太网模式

#mlxconfig -d /dev/mst/mt4119_pciconf0 set LINK_TYPE_P1=2
root@vnet:~#  mlxconfig -d /dev/mst/mt4119_pciconf0 q |grep  LINK_TYPE_P
         LINK_TYPE_P1                                ETH(2)          
         LINK_TYPE_P2                                ETH(2) 

测试

服务端

三个窗口分别开3个iperf3 server

iperf3 -s -p 5200
iperf3 -s -p 5201
iperf3 -s -p 5202

客户端

三个窗口分别同时开3个iperf3 client,跑10分钟

iperf3 -c 10.0.0.1 -p 5200 -t 600
iperf3 -c 10.0.0.1 -p 5201 -t 600
iperf3 -c 10.0.0.1 -p 5202 -t 600

iperf3结果

三个iperf3 Client, 合并速率大约 92GB/s

第一个

root@vnet:~# iperf3 -c 10.0.0.1 -p 5200 -t 600
Connecting to host 10.0.0.1, port 5200
[  5] local 10.0.0.2 port 39104 connected to 10.0.0.1 port 5200
[ ID] Interval           Transfer     Bitrate         Retr  Cwnd
[  5]   0.00-1.00   sec  5.70 GBytes  49.0 Gbits/sec  639   2.82 MBytes       
[  5]   1.00-2.00   sec  3.82 GBytes  32.8 Gbits/sec    0   2.82 MBytes       
[  5]   2.00-3.00   sec  3.65 GBytes  31.4 Gbits/sec    0   2.82 MBytes       
[  5]   3.00-4.00   sec  3.65 GBytes  31.4 Gbits/sec    0   2.82 MBytes       
[  5]   4.00-5.00   sec  3.70 GBytes  31.8 Gbits/sec    0   2.83 MBytes       
[  5]   5.00-6.00   sec  3.71 GBytes  31.8 Gbits/sec    0   2.83 MBytes       
[  5]   6.00-7.00   sec  3.66 GBytes  31.4 Gbits/sec    0   2.83 MBytes       
[  5]   7.00-8.00   sec  3.65 GBytes  31.4 Gbits/sec    0   2.85 MBytes       
[  5]   8.00-9.00   sec  3.65 GBytes  31.4 Gbits/sec    0   2.85 MBytes       
[  5]   9.00-10.00  sec  3.65 GBytes  31.4 Gbits/sec    0   2.89 MBytes       
...
[  5] 594.00-595.00 sec  3.65 GBytes  31.4 Gbits/sec    0   2.81 MBytes       
[  5] 595.00-596.00 sec  3.65 GBytes  31.4 Gbits/sec    0   2.81 MBytes       
[  5] 596.00-597.00 sec  3.65 GBytes  31.4 Gbits/sec    0   2.95 MBytes       
[  5] 597.00-598.00 sec  3.65 GBytes  31.4 Gbits/sec    0   2.95 MBytes       
[  5] 598.00-599.00 sec  3.65 GBytes  31.4 Gbits/sec    0   2.95 MBytes       
[  5] 599.00-600.00 sec  3.65 GBytes  31.4 Gbits/sec    0   2.95 MBytes       
- - - - - - - - - - - - - - - - - - - - - - - - -
[ ID] Interval           Transfer     Bitrate         Retr
[  5]   0.00-600.00 sec  2.14 TBytes  31.4 Gbits/sec  7061             sender
[  5]   0.00-600.00 sec  2.14 TBytes  31.4 Gbits/sec                  receiver

第二个

root@vnet:~# iperf3 -c 10.0.0.1 -p 5201 -t 600
Connecting to host 10.0.0.1, port 5201
[  5] local 10.0.0.2 port 42866 connected to 10.0.0.1 port 5201
[ ID] Interval           Transfer     Bitrate         Retr  Cwnd
[  5]   0.00-1.00   sec  4.76 GBytes  40.9 Gbits/sec    3   2.72 MBytes       
[  5]   1.00-2.00   sec  3.71 GBytes  31.9 Gbits/sec    0   2.72 MBytes       
[  5]   2.00-3.00   sec  3.65 GBytes  31.4 Gbits/sec    0   2.72 MBytes       
[  5]   3.00-4.00   sec  3.61 GBytes  31.0 Gbits/sec    0   2.72 MBytes       
[  5]   4.00-5.00   sec  3.55 GBytes  30.5 Gbits/sec    0   2.72 MBytes       
[  5]   5.00-6.00   sec  3.59 GBytes  30.8 Gbits/sec    0   2.72 MBytes       
[  5]   6.00-7.00   sec  3.65 GBytes  31.3 Gbits/sec    0   3.21 MBytes       
[  5]   7.00-8.00   sec  3.65 GBytes  31.3 Gbits/sec    0   3.21 MBytes       
[  5]   8.00-9.00   sec  3.65 GBytes  31.3 Gbits/sec    0   3.21 MBytes       
[  5]   9.00-10.00  sec  3.65 GBytes  31.3 Gbits/sec    0   3.21 MBytes       
[  5]  10.00-11.00  sec  3.65 GBytes  31.3 Gbits/sec    0   3.21 MBytes     
...
[  5] 594.00-595.00 sec  3.65 GBytes  31.4 Gbits/sec    0   4.76 MBytes       
[  5] 595.00-596.00 sec  3.65 GBytes  31.4 Gbits/sec    0   4.76 MBytes       
[  5] 596.00-597.00 sec  3.65 GBytes  31.4 Gbits/sec    0   4.76 MBytes       
[  5] 597.00-598.00 sec  3.65 GBytes  31.4 Gbits/sec    0   4.76 MBytes       
[  5] 598.00-599.00 sec  3.65 GBytes  31.4 Gbits/sec    0   4.76 MBytes       
[  5] 599.00-600.00 sec  4.24 GBytes  36.4 Gbits/sec    0   4.76 MBytes       
- - - - - - - - - - - - - - - - - - - - - - - - -
[ ID] Interval           Transfer     Bitrate         Retr
[  5]   0.00-600.00 sec  2.14 TBytes  31.4 Gbits/sec  270             sender
[  5]   0.00-600.00 sec  2.14 TBytes  31.4 Gbits/sec                  receiver

第三个

root@vnet:~# iperf3 -c 10.0.0.1 -p 5202 -t 600 
Connecting to host 10.0.0.1, port 5202
[  5] local 10.0.0.2 port 33730 connected to 10.0.0.1 port 5202
[ ID] Interval           Transfer     Bitrate         Retr  Cwnd
[  5]   0.00-1.00   sec  3.30 GBytes  28.4 Gbits/sec    0   1.76 MBytes       
[  5]   1.00-2.00   sec  3.65 GBytes  31.4 Gbits/sec    0   1.85 MBytes       
[  5]   2.00-3.00   sec  3.65 GBytes  31.4 Gbits/sec    0   1.85 MBytes       
[  5]   3.00-4.00   sec  3.70 GBytes  31.8 Gbits/sec    0   1.85 MBytes       
[  5]   4.00-5.00   sec  3.71 GBytes  31.8 Gbits/sec    0   1.85 MBytes       
[  5]   5.00-6.00   sec  3.66 GBytes  31.5 Gbits/sec    0   1.85 MBytes       
[  5]   6.00-7.00   sec  3.66 GBytes  31.4 Gbits/sec    0   1.85 MBytes       
[  5]   7.00-8.00   sec  3.66 GBytes  31.4 Gbits/sec    0   1.97 MBytes       
[  5]   8.00-9.00   sec  3.66 GBytes  31.4 Gbits/sec    0   1.97 MBytes       
[  5]   9.00-10.00  sec  3.66 GBytes  31.4 Gbits/sec    0   1.97 MBytes       
[  5]  10.00-11.00  sec  3.66 GBytes  31.4 Gbits/sec   50   1.53 MBytes 
...
[  5] 590.00-591.00 sec  3.65 GBytes  31.4 Gbits/sec    0   2.07 MBytes       
[  5] 591.00-592.00 sec  3.65 GBytes  31.4 Gbits/sec    0   2.07 MBytes       
[  5] 592.00-593.00 sec  3.65 GBytes  31.4 Gbits/sec    0   2.07 MBytes       
[  5] 593.00-594.00 sec  3.65 GBytes  31.4 Gbits/sec    0   2.07 MBytes       
[  5] 594.00-595.00 sec  3.65 GBytes  31.4 Gbits/sec    0   2.07 MBytes       
[  5] 595.00-596.00 sec  3.65 GBytes  31.4 Gbits/sec    0   2.07 MBytes       
[  5] 596.00-597.00 sec  3.65 GBytes  31.4 Gbits/sec    0   2.07 MBytes       
[  5] 597.00-598.00 sec  3.65 GBytes  31.4 Gbits/sec    0   2.07 MBytes       
[  5] 598.00-599.00 sec  3.65 GBytes  31.4 Gbits/sec    0   2.07 MBytes       
[  5] 599.00-600.00 sec  6.34 GBytes  54.4 Gbits/sec  715    824 KBytes       
- - - - - - - - - - - - - - - - - - - - - - - - -
[ ID] Interval           Transfer     Bitrate         Retr
[  5]   0.00-600.00 sec  2.15 TBytes  31.5 Gbits/sec  12151             sender
[  5]   0.00-600.00 sec  2.15 TBytes  31.5 Gbits/sec                  receiver

接口速率

在这里插入图片描述

其中发送速率12016406,基本稳定在1200000 KB/s以上

Trans KB/sTrans KbpsTrans MbpsTrans Gbps
120164069613124896131.24896.131248

Kpbs 与 KB/s换算关系是 x8。

Kbps Mbps Gbps换算倍数是 1000。

CPU占用

客户端

top - 07:48:53 up 5 min,  6 users,  load average: 0.61, 0.24, 0.10
Tasks: 765 total,   2 running, 763 sleeping,   0 stopped,   0 zombie
%Cpu(s):  0.0 us,  1.5 sy,  0.0 ni, 98.4 id,  0.0 wa,  0.0 hi,  0.1 si,  0.0 st
MiB Mem : 515430.8 total, 250782.5 free, 263932.7 used,    715.5 buff/cache
MiB Swap:   8192.0 total,   8192.0 free,      0.0 used. 249515.3 avail Mem 

    PID USER      PR  NI    VIRT    RES    SHR S  %CPU  %MEM     TIME+ COMMAND                                                                                     
   3394 root      20   0    5900   3184   2760 R  34.9   0.0   0:06.79 iperf3                                                                                      
   3393 root      20   0    5900   3100   2676 S  33.9   0.0   0:07.63 iperf3                                                                                      
   3392 root      20   0    5900   3188   2764 S  33.2   0.0   0:07.17 iperf3 

服务端

Tasks: 622 total,   3 running, 249 sleeping,   0 stopped,   0 zombie
%Cpu(s):  0.0 us,  2.3 sy,  0.0 ni, 97.1 id,  0.0 wa,  0.0 hi,  0.6 si,  0.0 st
KiB Mem : 52781030+total, 48375638+free, 43817464 used,   236448 buff/cache
KiB Swap:  4194300 total,  4194300 free,        0 used. 48168425+avail Mem 

  PID USER      PR  NI    VIRT    RES    SHR S  %CPU %MEM     TIME+ COMMAND                                                                                        
 3216 root      20   0    9752   2316   2064 R  67.4  0.0   0:32.56 iperf3                                                                                         
 3143 root      20   0    9884   2408   2148 S  59.5  0.0   7:45.59 iperf3                                                                                         
 3176 root      20   0    9884   2352   2096 R  55.8  0.0   6:41.01 iperf3  
### Linux 中 iperf 上行与下行带宽差异分析 在Linux环境中使用iperf工具测量网络性能时,可能会观察到上行和下行带宽之间存在显著差异。这种现象通常由以下几个因素引起: #### 1. 网络配置不对称 许多互联网服务提供商(ISP)提供给用户的宽带连接是非对称性的,即下载速度远高于上传速度。这意味着即使在同一局域网内的设备间执行iperf测试,也可能因为ISP设定而表现出不同的传输速率[^2]。 #### 2. 设备硬件限制 参与测试的两端计算机或其他网络装置可能具有不同规格的NIC(Network Interface Card),这些接口卡的数据处理能力直接影响着实际可达到的最大吞吐量。如果一方的网卡质量较差或老旧,则可能导致该方向上的流量受限于较低的速度上限[^1]。 #### 3. 路由器设置影响 某些路由器对于内外网访问有着特定的安全策略或是QoS(Quality of Service)规则,在进行跨子网通信时会对进出站的数据流实施不同程度的服务等级控制。当涉及到从内部发起对外部资源请求的情况(比如客户端向服务器发送大量数据),就容易受到此类机制干扰从而造成单边拥塞问题。 #### 4. 应用层协议特性 TCP/IP协议栈本身也会影响最终测得的结果。例如,默认情况下TCP采用慢启动算法来探测路径最大容量;而在多条并发连接场景下还存在着窗口缩放等因素制约整体表现。因此即使是相同物理链路上的不同应用实例也会因所选参数各异而导致实测数值有所偏差。 为了更直观地展示上述情况,可以运行如下命令来进行一次完整的双向带宽测试: ```bash # Server端保持监听状态等待Client连接 iperf -s # Client端指定目标地址并开启双向往返模式 iperf -c server_address -d -t 30 -i 5 ``` 通过调整iperf的各项选项以及对比多次实验所得平均值能够帮助定位具体瓶颈所在,并据此采取相应措施优化现有环境下的网络效能。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值