一、iperf
二进制包下载地址:https://iperf.fr/iperf-download.php
iperf是一个网络性能测试工具。iperf可以测试TCP和UDP带宽质量。iperf可以测量最大TCP带宽,具有多种参数和UDP特性。iperf可以报告带宽,延迟抖动和数据包丢失。利用iperf这一特性,可以用来测试一些网络设备如路由器,防火墙,交换机等的性能。
##服务端10.74.148.74启动iperf3,监听端口12345,请求间断时间1s
[root@host-192-168-1-76 ~]# iperf3 -s -p 12345 -i 1
-----------------------------------------------------------
Server listening on 12345
-----------------------------------------------------------
Accepted connection from 10.74.165.229, port 45368
[ 5] local 192.168.1.76 port 12345 connected to 10.74.165.229 port 45370
[ ID] Interval Transfer Bandwidth
[ 5] 0.00-1.00 sec 10.6 MBytes 88.5 Mbits/sec
[ 5] 1.00-2.00 sec 10.8 MBytes 90.7 Mbits/sec
[ 5] 2.00-3.00 sec 10.9 MBytes 91.5 Mbits/sec
[ 5] 3.00-4.00 sec 10.2 MBytes 85.5 Mbits/sec
[ 5] 4.00-5.00 sec 9.92 MBytes 83.2 Mbits/sec
[ 5] 5.00-6.00 sec 10.1 MBytes 84.4 Mbits/sec
[ 5] 6.00-7.00 sec 10.0 MBytes 84.1 Mbits/sec
[ 5] 7.00-8.00 sec 10.2 MBytes 85.6 Mbits/sec
[ 5] 8.00-9.00 sec 10.2 MBytes 86.0 Mbits/sec
[ 5] 9.00-10.00 sec 10.4 MBytes 87.0 Mbits/sec
[ 5] 10.00-10.05 sec 492 KBytes 87.0 Mbits/sec
- - - - - - - - - - - - - - - - - - - - - - - - -
[ ID] Interval Transfer Bandwidth
[ 5] 0.00-10.05 sec 0.00 Bytes 0.00 bits/sec sender
[ 5] 0.00-10.05 sec 104 MBytes 86.7 Mbits/sec receiver
-----------------------------------------------------------
Server listening on 12345
-----------------------------------------------------------
##客户端向10.74.148.74发起请求,请求间断时间1s,测试时间长度10s
[root@paas-controller-20-20-20-106:/home/ubuntu]$ iperf3 -c 10.74.148.74 -p 12345 -i 1 -t 10
Connecting to host 10.74.148.74, port 12345
[ 4] local 10.10.10.19 port 45370 connected to 10.74.148.74 port 12345
[ ID] Interval Transfer Bandwidth Retr Cwnd
[ 4] 0.00-1.00 sec 13.4 MBytes 113 Mbits/sec 60 203 KBytes
[ 4] 1.00-2.00 sec 10.8 MBytes 90.6 Mbits/sec 32 186 KBytes
[ 4] 2.00-3.00 sec 10.9 MBytes 91.6 Mbits/sec 63 141 KBytes
[ 4] 3.00-4.00 sec 10.1 MBytes 84.9 Mbits/sec 93 72.4 KBytes
[ 4] 4.00-5.00 sec 9.93 MBytes 83.3 Mbits/sec 28 112 KBytes
[ 4] 5.00-6.00 sec 10.1 MBytes 84.6 Mbits/sec 75 86.9 KBytes
[ 4] 6.00-7.00 sec 10.0 MBytes 84.2 Mbits/sec 28 115 KBytes
[ 4] 7.00-8.00 sec 10.2 MBytes 85.4 Mbits/sec 47 112 KBytes
[ 4] 8.00-9.00 sec 10.2 MBytes 85.9 Mbits/sec 57 94.8 KBytes
[ 4] 9.00-10.00 sec 10.4 MBytes 87.5 Mbits/sec 32 121 KBytes
- - - - - - - - - - - - - - - - - - - - - - - - -
[ ID] Interval Transfer Bandwidth Retr
[ 4] 0.00-10.00 sec 106 MBytes 89.1 Mbits/sec 515 sender
[ 4] 0.00-10.00 sec 104 MBytes 87.1 Mbits/sec receiver
iperf Done.
二、netperf
二进制包下载地址:https://pkgs.org/download/netperf
netperf是一种网络性能的测量工具,主要针对基于TCP或UDP的传输。Netperf根据应用的不同,可以进行不同模式的网络性能测试,即批量数据传输(bulk data transfer)模式和请求/应答(request/reponse)模式。
##服务端10.74.148.74开起12865的netserver程序监听
[root@host-192-168-1-76 ~]# netserver
Starting netserver with host 'IN(6)ADDR_ANY' port '12865' and family AF_UNSPEC
##客户端向10.74.148.74发起请求,测试时间长度10s
[root@paas-controller-20-20-20-106:/home/ubuntu]$ netperf -H 10.74.148.74 -l 10
MIGRATED TCP STREAM TEST from 0.0.0.0 (0.0.0.0) port 0 AF_INET to 10.74.148.74 () port 0 AF_INET
Recv Send Send
Socket Socket Message Elapsed
Size Size Size Time Throughput
bytes bytes bytes secs. 10^6bits/sec
87380 16384 16384 10.25 93.38
三、qperf
二进制包下载地址:https://pkgs.org/download/qperf
qperf 可以用来测试两个节点之间的带宽(bandwidth)和延迟(latency),除了支持tcp/udp/sctp外, qperf值得提的亮点是:第一可以支持RDMA测量,第二可进行循环遍历测试。这两点也是推荐该工具的主要原因。使用方法是:一个节点运行 qperf 作为服务端,另一个节点则运行 qperf 作为客户端,与服务端建立连接之后打流,获取带宽和延迟等数据。