Apache ab压力测试

Apache ab压力测试

1、 本地安装apache

2、 在安装目录下的bin目录双击ab.exe起动ab

3、 在cmd执行命令

a) 进入apache安装目录下的bin目录

b) 在bin目录下执行压测命令,如下:

D:\AppServ\Apache2.2\bin>ab -n 10 -c 5 http://120.25.105.232/wordpress/

# -n :总共请求数; -c:总共并发数;意思是5个用户一共发送10个请求

This is ApacheBench, Version 2.0.40-dev <$Revision: 1.146 $> apache-2.0

Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/

Copyright 2006 The Apache Software Foundation, http://www.apache.org/

Benchmarking 120.25.105.232 (be patient).....done

Server Software: Apache/2.2.15 服务器版本信息

Server Hostname: 120.25.105.232 服务器主机名

Server Port: 80 服务器端口号

Document Path: /wordpress/ 测试页面的路径

Document Length: 45892 bytes 测试页面的大小

Concurrency Level: 5 所有并发用户数

Time taken for tests: 4.584459 seconds 所有这些请求处理完成所花费的时间

Complete requests: 10 总共完成的请求数

Failed requests: 0 失败的请求数

Write errors: 0

Total transferred: 461230 bytes 网络总传输量

HTML transferred: 458920 bytes HTML内容传输量

Requests per second: 2.18 [#/sec] (mean) 吞吐量-每秒处理请求数=总请求数 / 处理完成这些请求数所花费的时间,即Request per second = Complete requests / Time taken for tests

Time per request: 2292.229 [ms] (mean) 平均响应时间(用户平均请求等待时间)

Time per request: 458.446 [ms] (mean, across all concurrent requests) 服务器平均处理时间

Transfer rate: 98.16 [Kbytes/sec] received 平均每秒网络上的流量,(传输速率)

网络上消耗的时间的分解:

Connection Times (ms)

min mean[+/-sd] median max

Connect: 4 81 97.0 88 249

Processing: 1051 1924 730.7 2123 2890

Waiting: 639 996 335.4 1074 1488

Total: 1249 2006 654.9 2129 2897

整个场景中所有请求的响应情况

Percentage of the requests served within a certain time (ms)

50% 2129

66% 2372

75% 2711

80% 2817

90% 2897

95% 2897

98% 2897

99% 2897

100% 2897 (longest request)

10个并发,100个请求

D:\AppServ\Apache2.2\bin>ab -n 100 -c 10 http://120.25.105.232/wordpress/

This is ApacheBench, Version 2.0.40-dev <$Revision: 1.146 $> apache-2.0

Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/

Copyright 2006 The Apache Software Foundation, http://www.apache.org/

Benchmarking 120.25.105.232 (be patient).....done

Server Software: Apache/2.2.15

Server Hostname: 120.25.105.232

Server Port: 80

Document Path: /wordpress/

Document Length: 45892 bytes

Concurrency Level: 10

Time taken for tests: 36.594659 seconds

Complete requests: 100

Failed requests: 0

Write errors: 0

Total transferred: 4612300 bytes

HTML transferred: 4589200 bytes

Requests per second: 2.73 [#/sec] (mean)

Time per request: 3659.466 [ms] (mean)

Time per request: 365.947 [ms] (mean, across all concurrent requests)

Transfer rate: 123.08 [Kbytes/sec] received

Connection Times (ms)

min mean[+/-sd] median max

Connect: 4 314 131.1 346 1052

Processing: 1052 3264 1086.2 3101 7664

Waiting: 490 1227 611.1 1051 3203

Total: 1450 3578 1007.7 3439 7672

Percentage of the requests served within a certain time (ms)

50% 3439

66% 3449

75% 3460

80% 3498

90% 4652

95% 6368

98% 7266

99% 7672

100% 7672 (longest request)