Netperf是一种网络性能的测量工具,可以测试基于TCP或UDP吞吐、响应速率。Netperf包括Clien和Server端,Server端主要用来实现监听工作,Client端进行测试。根据流量传输方式可分为以下三种:
[root@localhost ~]# netserver
Starting netserver with host'IN(6)ADDR_ANY' port '12865' and family AF_UNSPEC
指定监听端口:
[root@localhost tmp]# netserver -p 1180
Starting netserver with host'IN(6)ADDR_ANY' port '1180' and family AF_UNSPEC
netperf [global options] -- [test options]
其中,global options为通用参数,所有测试项目都涉及或者说是公共的参数,test options是测试项用的参数。
[root@localhost ~]# netperf -t TCP_STREAM -H 192.168.0.221 -l 10 -P 1180
MIGRATED TCP STREAM TEST from 0.0.0.0(0.0.0.0) port 0 AF_INET to 192.168.0.221 () 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.00 4586.58
测试结果:吞吐为4.5G/s。
[root@localhost ~]# netperf -t UDP_STREAM -H 192.168.0.221 -l 10
MIGRATED UDP STREAM TEST from 0.0.0.0(0.0.0.0) port 0 AF_INET to 192.168.0.221 () port 0 AF_INET
Socket Message Elapsed Messages
Size Size Time Okay Errors Throughput
bytes bytes secs # # 10^6bits/sec
212992 65507 10.00 78233 0 4099.59
212992 10.00 74263 3891.55
测试结果:
[root@localhost ~]# netperf -t TCP_RR -H 192.168.0.221 -l 10 -- -r 256,2048
MIGRATED TCP REQUEST/RESPONSE TEST from0.0.0.0 (0.0.0.0) port 0 AF_INET to 192.168.0.221 () port 0 AF_INET : firstburst 0
Local /Remote
Socket Size Request Resp. Elapsed Trans.
Send Recv Size Size Time Rate
bytes Bytes bytes bytes secs. per sec
16384 87380 256 2048 10.00 6020.25
16384 87380
测试结果: