基础信息
- 被测机:被压力测试网络性能的弹性云服务器,可作为测试中的client端(发送端)。
- 辅助云服务器:作为测试中的server端(接收端)。
- 测试工具:iperf3,curl,nginx,wrk。
测试工具命令示例
- iperf3:
- server: iperf3 -s [ip地址] -D -p[端口]
- client: iperf3 -c [ip地址] -p[端口] -b[带宽大小] -t[测试时间]
2. curl:
- curl -o /dev/null -s -w %{time_namelookup}---%{time_connect}---%{time_starttransfer}---%{time_total}---%{speed_download}"\n" ip:端口
3. nginx
- nginx -c /ect/nginx/nginx.comf
4. wrk
wrk -d [时间] -t [连接数] -c [并发数] ip:端口
测试步骤:
1. 测试带宽:
server 开启指定端口服务:
iperf3 -s xxx -D -p xxx
client打对应端口固定带宽的流量:
iperf3 -c xxx -p xxx -b xxx -t xxx
2 .测试连接数:
server 开启指定端口服务:
nginx -c /ect/nginx/nginx.comf
client建立并发连接:
wrk -d xxx -t xxx -c xxx ip:xxx
3. 测试延时:
server 开启指定端口服务:
nginx -c /ect/nginx/nginx.comf
client 测试延时
for ((a=1;a<=3600;a++));
do
time=$(date +%Y%m%d%H%M%S)
curl_result=`curl -o /dev/null -s -w %{time_namelookup}---%{time_connect}---%{time_starttransfer}---%{time_total}---%{speed_download}"\n" "ip:端口"`
echo "$time $curl_result" >> curl_result.log
sleep 1
done