日期:2014-05-16  浏览次数:20893 次

HTTP压力测试工具(一)apache的ab
2009-10-13 18:01HTTP压力测试工具(一)apache的ab

ab文档
http://httpd.apache.org/docs/2.0/programs/ab.html

一般安装了apache后在bin下就有ab.exe(WINDOWS)

常用参数
测试公司机器首页
D:\tool\Apache Group\Apache2\bin>ab -n 1000 -c 64 http://10.206.20.41:7001/projectname /
测试GOOGLE页面
ab -n 1000 -c 64 http://www.google.com/

-n是请求并运行1000次,-c是64个并发,测试返回结果如下:
This is ApacheBench, Version 2.0.41-dev <$Revision: 1.121.2.12 $> apache-2.0
Copyright (c) 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Copyright (c) 2006 The Apache Software Foundation, http://www.apache.org/

Benchmarking 10.206.20.41 (be patient)
Completed 100 requests
Completed 200 requests
Completed 300 requests
Completed 400 requests
Completed 500 requests
Completed 600 requests
Completed 700 requests
Completed 800 requests
Completed 900 requests
Finished 1000 requests

Server Software:
//平台版本
Server Hostname:        10.206.20.41
//服务器主机名
Server Port:            7001
//服务器端口
Document Path:          /icpmis/
//测试页面
Document Length:        285 bytes
//页面大小

Concurrency Level:      64
//并发数
Time taken for tests:   10.859375 seconds
//整个测试持续的时间
Complete requests:      1000
//完成请求数
Failed requests:        1
//失败请求数
   (Connect: 0, Length: 1, Exceptions: 0)
Write errors:           0
Non-2xx responses:      999
Total transferred:      607392 bytes
//整个场景中的网络传输量
HTML transferred:       284715 bytes
//整个场景中的HTML内容传输量
Requests per second:    92.09 [#/sec] (mean)
//指标之一,每秒事务数(平均值)
Time per request:       695.000 [ms] (mean)
//指标之二,平均事务响应时间(平均值)
Time per request:       10.859 [ms] (mean, across all concurrent requests)
//每个请求实际运行时间
Transfer rate:          54.61 [Kbytes/sec] received
//平均每秒网络上的流量

Connection Times (ms)
              min mean[+/-sd] median   max
Connect:        0    0   2.3      0      15
Processing:    78 214 632.2    125    9000
Waiting:      -15 202 569.7    125    9000
Total:         78 214 632.2    125    9000
//网络消耗时间分解

Percentage of the requests served within a certain time (ms)
50%    125
66%    125
75%    140
80%    140
90%    140
95%    171
98%   2968
99%   3000
100%   9000 (longest request)
//整个场景中所有请求的响应情况,其中50%的用户响应时间小于125毫秒