3、UDP协议测试
UDP协议是RAC私有网络互联的标准协议类型。使用iperf可以进行标准测试带宽。通过额外的-u参数,可以开启IPerf进入UDP工作模式。
[root@TESTAUDDB iperf]# ./iperf64 -s -u
-----------------------------------------------
Server listening on UDP port 5001
Receiving 1470 byte datagrams
UDP buffer size: 4.00 MByte (default)
--------------------------------------------
客户端方面,也需要加入-u参数进行UDP数据包发送。
[root@TESTAUDAPP iperf]# ./iperf64 -u -c 172.16.3.27
-------------------------------------
Client connecting to 172.16.3.27, UDP port 5001
Sending 1470 byte datagrams
UDP buffer size: 4.00 MByte (default)
--------------------------------------------
[ 3] local 172.16.3.28 port 24436 connected with 172.16.3.27 port 5001
[ ID] Interval Transfer Bandwidth
[ 3] 0.0-10.0 sec 1.25 MBytes 1.05 Mbits/sec
[ 3] Sent 893 datagrams
[ 3] Server Report:
[ ID] Interval Transfer Bandwidth Jitter Lost/Total Datagrams
[ 3] 0.0-10.0 sec 1.25 MBytes 1.05 Mbits/sec 0.005 ms 0/ 893 (0%)
测试结果中,UDP连接带宽为1.05Mbit/sec。
对指定时间发送的数据量,1.25Mbytes是默认取值。我们可以根据实际的情况进行调节,通过参数-b可以设置数据量。
[root@TESTAUDAPP iperf]# ./iperf64 -u -c 172.16.3.27 -b 10m
------------------------------------------------
Client connecting to 172.16.3.27, UDP port 5001
Sending 1470 byte datagrams
UDP buffer size: 4.00 MByte (default)
--------------------------------------------------
[ 3] local 172.16.3.28 port 9254 connected with 172.16.3.27 port 5001
[ ID] Interval Transfer Bandwidth
[ 3] 0.0-10.0 sec 11.9 MBytes 10.0 Mbits/sec
[ 3] Sent 8505 datagrams
[ 3] Server Report:
[ ID] Interval Transfer Bandwidth Jitter Lost/Total Datagrams
[ 3] 0.0-10.0 sec 11.9 MBytes 10.0 Mbits/sec 0.006 ms 0/ 8505 (0%)
实际测试中,可以设置比较大的数据包值,给予一定的数据压力。但是-b只能在UDP协议中使用,在TCP协议中不能用。
[root@TESTAUDAPP iperf]# ./iperf64 -c 172.16.3.27 -b 10m
WARNING: option -b implies udp testing
-------------------------------------------
Client connecting to 172.16.3.27, UDP port 5001
Sending 1470 byte datagrams
UDP buffer size: 4.00 MByte (default)
---------------------------------------
[ 3] local 172.16.3.28 port 33902 connected with 172.16.3.27 port 5001
write2 failed: Connection refused
[ ID] Interval Transfer Bandwidth
[ 3] 0.0- 0.0 sec 1.44 KBytes 9.58 Mbits/sec
[ 3] Sent 1 datagrams
read failed: Connection refused
[ 3] WARNING: did not receive ack of last datagram after 1 tries.
最后,测试一下本机之间的连接情况,也就是连接127.0.0.1本地地址。
[root@TESTAUDDB iperf]# ./iperf64 -c 127.0.0.1
-------------------------------------
Client connecting to 127.0.0.1, TCP port 5001
TCP window size: 49.6 KByte (default)
--------------------------------------------
[ 3] local 127.0.0.1 port 17502 connected with 127.0.0.1 port 5001
[ ID] Interval Transfer Bandwidth
[ 3] 0.0-10.0 sec 13.0 GBytes 11.2 Gbits/sec
4、结论
IPerf是我们进行网络实测的好工具,记录下来,留待需要的朋友不时之需。
