Use AB for stress testing of pages
Http://www.cnblogs.com/yjf512/archive/2011/05/24/2055723.html
AB is a very useful stress test tool from Apache, and when you have finished installing Apache, you can find AB in the bin below.
1 We can simulate 100 concurrent users, send 1000 requests to a page
./ab-n1000-c100 http://vm1.jianfeng.com/a.html
Where-n represents the number of requests, and-C represents the number of concurrent
return Result:
# #首先是apache的版本信息
This is Apachebench, Version 2.3 <>
Copyright 1996 Adam Twiss, Zeus technology LTD, http://www.zeustech.net/
Licensed to the Apache software Foundation, http://www.apache.org/
Benchmarking vm1.jianfeng.com (Be patient)
Server software:apache/2.2.19 # #apache版本
Server Hostname:vm1.jianfeng.com # #请求的机子
Server port:80 # #请求端口
Document Path:/a.html
Document length:25 Bytes # #页面长度
Concurrency level:100 # #并发数
Time taken for tests:0.273 seconds # #共使用了多少时间
Complete requests:1000 # #请求数
Failed requests:0 # #失败请求
Write errors:0
Total transferred:275000 bytes # #总共传输字节数, header information including HTTP, etc.
HTML transferred:25000 Bytes # #html字节数, the actual number of page bytes passed
Requests per second:3661.60 [#/sec] (mean) # #每秒多少请求, this is a very important parameter value, the throughput of the server
Time per request:27.310 [MS] (mean) # #用户平均请求等待时间
Time per request:0.273 [MS] (mean, across all concurrent requests) # #服务器平均处理时间, which is the reciprocal of server throughput
Transfer rate:983.34 [Kbytes/sec] Received # #每秒获取的数据长度
Connection Times (MS)
Min MEAN[+/-SD] Median max
Connect:0 1 2.3 0 16
Processing:6 25 3.2 25 32
Waiting:5 24 3.2 25 32
Total:6 25 4.0 25 48
Percentage of the requests served within a certain time (MS)
50% 25 # # 50% request returned within 25MS
66% 26 # # 60% request returned within 26MS
75% 26
80% 26
90% 27
95% 31
98% 38
99% 43
100% (Longest request)
2 AB can also run in Windows, and if you install Apache under Windows, you can find Ab.exe under the bin
Can be used directly, without relying on other DLLs
Here are the results of a page I used to test Sina Ab.exe:
c:\users\nickyjf\desktop\useful>ab-n1000-c100 http://sports.sina.com.cn/k/2011-05-24/12095590365.shtml
This is Apachebench, Version 2.3 <>
Copyright 1996 Adam Twiss, Zeus technology LTD, http://www.zeustech.net/
Licensed to the Apache software Foundation, http://www.apache.org/
Benchmarking sports.sina.com.cn (Be patient)
Completed requests
Completed requests
Completed requests
Completed requests
Completed requests
Completed requests
Completed requests
Completed requests
Completed requests
Completed requests
Finished requests
Server software:apache/2.0.63
Server Hostname:sports.sina.com.cn
Server port:80
Document Path:/k/2011-05-24/12095590365.shtml
Document length:86680 bytes
Concurrency level:100
Time taken for tests:66.453 seconds
Complete requests:1000
Failed requests:0
Write errors:0
Total transferred:87135790 bytes
HTML transferred:86680000 bytes
Requests per second:15.05 [#/sec] (mean)
Time per request:6645.294 [MS] (mean)
Time per request:66.453 [MS] (mean, across all concurrent requests)
Transfer rate:1280.51 [Kbytes/sec] Received
Connection Times (MS)
Min MEAN[+/-SD] Median max
Connect:1 56 398.3 2 3003
processing:89 6331 2603.7 6293 14626
Waiting:2 1748 1485.9 1590 6284
total:90 6388 2615.0 6302 14627
Percentage of the requests served within a certain time (MS)
50% 6302
66% 7121
75% 8435
80% 9193
90% 9231
95% 9385
98% 11549
99% 12459
100% 14627 (Longest request)
3 Apache's AB tool is also considered a DDoS attack tool
Use AB for stress testing of pages