压力测试
1、Apache ab
https://www.apachehaus.com/cgi-bin/download.plx
1 2 3 |
yum -y install httpd-tools ab -n 10000 -c 100 http://127.0.0.1/index.html |
-n 总请求次数
-c 并发次数(不能大于-n)
- Document Length: xxxx bytes HTTP响应数据的正文长度
- Time taken for tests: xxxxx seconds 所有请求处理完成所花费的时间
- Complete requests: xxxx 完成请求数
- Failed requests: 0 失败请求数
- Total transferred: xxxxxx bytes 网络总传输量
- HTML transferred: xxxx bytes HTML内容传输量
- Requests per second: xxxx [#/sec] (mean) 吞吐量-每秒请求数
- Time per request: xxx[ms] (mean) 每一次(用户)请求响应时间 (Time taken for tests/次数)
- Time per request: xxx [ms] (mean, across all concurrent requests) 并发的每个请求平均消耗时间
(上面一个Time per request/并发数) - Transfer rate: 网络传输速度
macOS 测试时报socket: Too many open files (24),设置
1 |
ulimit -n 10000 |
2、hey
采用 Golang 编写,较 Apache ab 更为优秀,具有直方图等更为详细的信息
macOS 下载https://hey-release.s3.us-east-2.amazonaws.com/hey_darwin_amd64
1 2 3 4 |
mv hey_darwin_amd64 ~/go/bin/hey chmod +x ~/go/bin/hey hey -n 1500 -c 500 http://xxx.xxx # hey -n 3000 -c 1500 -T application/json -D xxx.json -m POST http://xxx.xxx |
Jmeter
TestNG