网络性能检测
使用,在root用户下安装:
$ wget https://downloads.es.net/pub/iperf/iperf-3.10.tar.gz
$ tar -zxvf iperf-3.10.tar.gz
$ cd iperf-3.10
$ chmod 777 ./configure
$ ./configure; make; make install
在一台服务器上启动服务端:iperf3 -s
,在另一台上启动客户端执行如下命令:
# 用TCP的方式测试本机到192.168.10.41主机的网络性能,时长为60秒,每10秒打印一次测试结果,每次发送1M的数据,开启100个线程
$ iperf3 -c 192.168.10.41 -t 60 -i 10 -b 1M -P 100
Connecting to host 192.168.10.41, port 5201
[ 5] local 192.168.10.43 port 49074 connected to 192.168.10.41 port 5201
[ 7] local 192.168.10.43 port 49076 connected to 192.168.10.41 port 5201
[ 9] local 192.168.10.43 port 49078 connected to 192.168.10.41 port 5201
...
[ ID] Interval Transfer Bitrate Retr Cwnd
[ 5] 0.00-10.00 sec 1.25 MBytes 1.05 Mbits/sec 0 58.0 KBytes
[ 7] 0.00-10.00 sec 1.25 MBytes 1.05 Mbits/sec 0 58.0 KBytes
[ 9] 0.00-10.00 sec 1.25 MBytes 1.05 Mbits/sec 0 59.4 KBytes
...
[SUM] 0.00-10.00 sec 125 MBytes 105 Mbits/sec 0
- - - - - - - - - - - - - - - - - - - - - - - - -
[ 5] 10.00-20.00 sec 1.25 MBytes 1.05 Mbits/sec 0 59.4 KBytes
[ 7] 10.00-20.00 sec 1.25 MBytes 1.05 Mbits/sec 0 59.4 KBytes
[ 9] 10.00-20.00 sec 1.25 MBytes 1.05 Mbits/sec 0 59.4 KBytes
...
...
...
- - - - - - - - - - - - - - - - - - - - - - - - -
[ ID] Interval Transfer Bitrate Retr
[ 5] 0.00-60.00 sec 7.25 MBytes 1.01 Mbits/sec 0 sender
[ 5] 0.00-60.00 sec 7.25 MBytes 1.01 Mbits/sec receiver
[ 7] 0.00-60.00 sec 7.25 MBytes 1.01 Mbits/sec 0 sender
[ 7] 0.00-60.00 sec 7.25 MBytes 1.01 Mbits/sec receiver
[ 9] 0.00-60.00 sec 7.25 MBytes 1.01 Mbits/sec 0 sender
[ 9] 0.00-60.00 sec 7.25 MBytes 1.01 Mbits/sec receiver
...
[SUM] 0.00-60.00 sec 725 MBytes 101 Mbits/sec 0 sender
[SUM] 0.00-60.00 sec 725 MBytes 101 Mbits/sec receiver
从执行结果可以看出,TCP通信在60s
内执行的测试任务,每个线程发送1M
数据,速率为100 Mbits/sec
左右,每秒传输100 MBytes
左右的数据,Cwnd
有50 KByte
左右,存在TCP拥塞情况,在最后的SUM
可以看到执行的全部统计,总共传输了725 MBytes
的数据,比预计的1000 MBytes
要少,但Retr
为0
,没有出现重发数据包的情况。
客户端再加上-u
参数执行,即为测试UDP
通信,结果会展示网络延迟和丢包情况。
参数含义
命令涉及参数含义:
-s 以server服务模式启动
-D 后台运行
-c 指定测试端的IP地址
-t 测试时常,单位为秒
-b 设置发送带宽,每一次发送的数据大小(对UDP来说默认是1M 比特/秒,对TCP来说默认是不限制)
-f 测试结果的单位 (kbits,Mbits,KBytes,MBytes)
-p 可指定端口 默认端口为5201
-P 表示线程个数,不指定则默认单线程
-u 使用 UDP 协议(默认TCP)
输出结果参数含义:
Interval:输出结果的时间间隔
Transfer:间隔时间内传输的总流量
Bandwidth:间隔时间内的最大吞吐量
Retr: 重发包数
Cwnd: 拥塞窗口排队数据量大小
磁盘测试
1st test memory to memory:
server: iperf3 -s
client: iperf3 -c testhost
Then disk to memory(读取客户端指定的文件发送给服务端内存):
server: iperf3 -s
client: iperf3 -c testhost -F filename
Then memory to disk(由客户端发数据到服务端写入指定的文件中):
server: iperf3 -s -F filename
client: iperf3 -c testhost
磁盘IO监控
安装:
yum install iotop
yum install sysstat