压力测试使用的工具

本次压力测试使用http_load工具进行测试
测试环境: 未来网络试验设施内网测试
测试目标: 纯静态页面前端,没有做后端接口所以只能测试前端页面…..
机器: Ubuntu18.04-Server * 3
由未来网络试验设施提供
配置参数不做统计,本次测试为娱乐测试,不可作为参考
工具地址

http://acme.com/software/http_load/

参考文档

https://blog.csdn.net/mmk1992/article/details/51296294

https://www.cnblogs.com/qlqwjy/p/8040067.html

https://blog.csdn.net/m0_67695717/article/details/128154553?spm=1001.2101.3001.6650.2&utm_medium=distribute.pc_relevant.none-task-blog-2%7Edefault%7EBlogCommendFromBaidu%7ERate-2-128154553-blog-82257644.235%5Ev38%5Epc_relevant_sort_base3&depth_1-utm_source=distribute.pc_relevant.none-task-blog-2%7Edefault%7EBlogCommendFromBaidu%7ERate-2-128154553-blog-82257644.235%5Ev38%5Epc_relevant_sort_base3&utm_relevant_index=1

编译压力测试工具

1
2
3
wget http://www.acme.com/software/http_load/http_load-09Mar2016.tar.gz
tar -xzvf http_load-09Mar2016.tar.gz
cd http_load-09Mar2016.tar.gz

编辑Makefile以提供SSL支持

1
2
3
4
5
#取消注释
SSL_TREE = /usr/local/ssl
SSL_DEFS = -DUSE_SSL
SSL_INC = -I$(SSL_TREE)/include
SSL_LIBS = -L$(SSL_TREE)/lib -lssl -lcrypto
1
2
3
4
5
6
sudo apt install gcc cmake
sudo make
#有可能提示没有openssl
#Ubuntu下
#sudo apt install libssl-dev
sudo make && sudo make install

创建url文件

1
2
#vim urllist.txt
https://xxxxx:30443/index.html

压力测试(娱乐)

参数
-parallel 简写-p :含义是并发的用户进程数。
-fetches 简写-f :含义是总计的访问次数
-rate 简写-r :含义是每秒的访问频率
-seconds简写-s :含义是总计的访问时间
选择参数时, -parallel和-rate选其中一个,-fetches和-seconds选其中一个

3个测试节点同时测试

测试参数
http_load -p 5000 -s 10 urllist.txt
同时使用5000个进程,访问urllist.txt列表中的网址,持续10秒钟(很显然5000个进程对于测试机器来说好像不太现实)

1
2
3
4
5
6
7
8
9
#测试节点1
ustc@nazawszestresstest1-0367:~/http_load-09Mar2016$ http_load -p 5000 -s 10 urllist.txt
3479 fetches, 32 max parallel, 1.00613e+07 bytes, in 10.039 seconds
2892 mean bytes/connection
346.55 fetches/sec, 1.00222e+06 bytes/sec
msecs/connect: 31.5525 mean, 256.08 max, 0.845 min
msecs/first-response: 31.5858 mean, 256.08 max, 23.071 min
HTTP response codes:
code 200 -- 3479
1
2
3
4
5
6
7
8
9
#测试节点2
ustc@nazawszestresstest2-0367:~/http_load-09Mar2016$ http_load -p 5000 -s 15 urllist.txt
4989 fetches, 32 max parallel, 1.44282e+07 bytes, in 15.0035 seconds
2892 mean bytes/connection
332.522 fetches/sec, 961654 bytes/sec
msecs/connect: 33.0144 mean, 269.692 max, 0.648 min
msecs/first-response: 32.9348 mean, 269.692 max, 14.309 min
HTTP response codes:
code 200 -- 4989
1
2
3
4
5
6
7
8
9
#测试节点3
ustc@nazawszestresstest3-0367:~/http_load-09Mar2016$ http_load -p 5000 -s 15 urllist.txt
5039 fetches, 33 max parallel, 1.45728e+07 bytes, in 15.0017 seconds
2892 mean bytes/connection
335.894 fetches/sec, 971406 bytes/sec
msecs/connect: 32.6939 mean, 255.614 max, 0.677 min
msecs/first-response: 32.7164 mean, 255.614 max, 9.364 min
HTTP response codes:
code 200 -- 5039

测试参数
http_load -rate 1000 -seconds 60 urllist.txt
每秒请求1000次,持续60秒

1
2
3
4
5
6
7
8
9
#测试节点1
ustc@nazawszestresstest1-0367:~/http_load-09Mar2016$ http_load -rate 1000 -seconds 60 urllist.txt
7694 fetches, 13 max parallel, 2.2251e+07 bytes, in 60.0136 seconds
2892 mean bytes/connection
128.204 fetches/sec, 370767 bytes/sec
msecs/connect: 25.5968 mean, 317.252 max, 17.363 min
msecs/first-response: 26.9707 mean, 317.252 max, 17.363 min
HTTP response codes:
code 200 -- 7694
1
2
3
4
5
6
7
8
9
#测试节点2
ustc@nazawszestresstest2-0367:~/http_load-09Mar2016$ http_load -rate 1000 -seconds 60 urllist.txt
7312 fetches, 13 max parallel, 2.11463e+07 bytes, in 60.0222 seconds
2892 mean bytes/connection
121.822 fetches/sec, 352308 bytes/sec
msecs/connect: 26.7576 mean, 304.744 max, 17.264 min
msecs/first-response: 28.0297 mean, 304.744 max, 19.04 min
HTTP response codes:
code 200 -- 7312
1
2
3
4
5
6
7
8
9
#测试节点3
ustc@nazawszestresstest3-0367:~/http_load-09Mar2016$ http_load -rate 1000 -seconds 60 urllist.txt
5824 fetches, 13 max parallel, 1.6843e+07 bytes, in 60.029 seconds
2892 mean bytes/connection
97.0197 fetches/sec, 280581 bytes/sec
msecs/connect: 35.4713 mean, 309.838 max, 18.152 min
msecs/first-response: 36.9185 mean, 309.838 max, 27.066 min
HTTP response codes:
code 200 -- 5824

stresstestpic.png