Stress-Test your application in Linux
Author: site
Email: [Email protected]
qq:511363759
I. Webbench
1. Install webbench-in Ubuntu to support Get,head and other requests, but does not support post requests
wget http://blog.zyan.cc/soft/linux/webbench/webbench-1.5.tar.gztar zxvf webbench-1.5.tar.gzcd webbench-1.5make && make install
2. Test Demo
webbench -t 5 -c 2 http://google.com/ >2个并发用户共同请求5秒
3. Test results Analysis
Benchmarking: GET http://google.com/ #GET方法请求谷歌
2 clients, running 5 sec. #2个用户,运行5秒
Speed=4296 pages/min, 38664 bytes/sec. #4296个页面每秒,38664 bytes每秒
Requests: 358 susceed, 0 failed. #358次请求成功,0次失败
Two. Ab1. Install ab-in Ubuntu support post, get, head and other methods
sudo apt-get install apache2-utils
2. Test Demo
ab -n 500 -c 2 http://www.google.com/ >2个并发用户共同请求个数500个。
3. Test results Analysis
Server Software: gws #服务器信息
Server Hostname: www.google.com #测试地址
Server Port: 80 #测试端口
Document Path: / #测试文档路径
Document Length: 390 bytes #测试文档大小
Concurrency Level: 2 #并发数量
Time taken for tests: 6.752 seconds #测试消耗时间
Complete requests: 500 #完成的请求数
Failed requests: 0 #失败的请求数
Non-2xx responses: 500 #HTTP响应数据的头信息中含有2XX以外的状态码的请求数
Total transferred: 566000 bytes #总传输数据大小
HTML transferred: 195000 bytes #总传输html数据大小
Requests per second: 74.05 [#/sec] (mean) #吞吐量,每秒处理平均请求数
-
time per request: Span class= "lit" >27.007 [ms (mean #每个请求平均等待时间
Time per request: 13.504 [ms] (mean, across all concurrent requests) #服务器每个请求平均处理时间
Transfer rate: 81.86 [Kbytes/sec] received #平均每秒流量数
Connection Times (ms) #下面为时间花费的分布(连接、处理、等待、总数)
min mean[+/-sd] median max
Connect: 1 1 0.2 1 2
Processing: 22 26 7.6 25 150
Waiting: 22 26 7.6 25 150
Total: 23 27 7.6 26 151
###下面为每个请求花费时间的分布
Percentage of the requests served within a certain time (ms)
50% 26 #50%在26毫秒之内
66% 27 #66%在27毫秒之内
75% 27
80% 27
90% 28 #主要看这个参数,90%在28毫秒之内
95% 29
98% 36
99% 52
100% 151 (longest request)
To add data to the request header, as follows:
ab -H "Cookie: key=value;key2=value2" ...
4. Use AB for post requests
ab -c 1 -n 100 -T ‘application/json‘ -p data.json http://www.google.com/
The test results are not posted, and one more obvious result:
Total body sent: 15900 #body总的发送量
Stress-Test your application in Linux