51Testing丛书:性能测试进阶指南—LoadRunner 11实战(26)

发表于:2012-6-25 11:50

字体: | 上一篇 | 下一篇 | 我要投稿

 作者:陈霁    来源:51Testing软件测试网原创

B.2  Apache AB

  AB的全称是ApacheBench,是 Apache 附带的一个小工具,专门用于 HTTP Server 的benchmark testing,可以同时模拟多个并发请求。

  我们先编写一个这样的命令来对www.google.com进行一个简单的性能测试

ab -n 10 -c 10 http://www.google.com/
//启动AB,向 www.google.com 发送10个请求(-n 10) ,并每次发送10个请求(-c 10)

  运行后我们可以看到下面的AB输出测试报告。

www/web/Apache/bin/ab -n 10 -c 10 http://www.google.com/
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 1997-2005 The Apache Software Foundation, http://www.apache.org/
Benchmarking www.google.com (be patient).....done
Server Software:        GWS/2.1
Server Hostname:        www.google.com
Server Port:            80
Document Path:          /
Document Length:        230 bytes
Concurrency Level:      10

/*整个测试持续的时间*/
Time taken for tests:   3.234651 seconds

/*完成的请求数量*/
Complete requests:      10

/*失败的请求数量*/
Failed requests:        0
Write errors:           0
Non-2xx responses:      10
Keep-Alive requests:    10

/*整个场景中的网络传输量*/
Total transferred:      6020 bytes

/*整个场景中的HTML内容传输量*/
HTML transferred:       2300 bytes

/*相当于LR中的每秒事务数,后面括号中的mean表示这是一个平均值*/
Requests per second:    3.09 [#/sec] (mean)

  /*每个请求的响应时间,相当于LR中的平均事务响应时间,后面括号中的mean表示这是一个平均值*/
Time per request:       3234.651 [ms] (mean)

/*每个请求的响应时间,基于并行计算*/
Time per request:       323.465 [ms] (mean, across all concurrent requests)

/*平均每秒网络上的流量,可以帮助排除是否存在网络流量过大导致响应时间延长的问题*/
Transfer rate:          1.55 [Kbytes/sec] received

/*网络上消耗的时间的分解*/
Connection Times (ms)
              min  mean[+/-sd] median   max
Connect:       20  318 926.1     30    2954
Processing:    40 2160 1462.0   3034    3154
Waiting:       40 2160 1462.0   3034    3154
Total:         60 2479 1276.4   3064    3184

/*下面的内容为整个场景中所有请求的响应情况。在场景中每个请求都有一个响应时间,其中 50% 的用户响应时间小于 3064 毫秒,60 % 的用户响应时间小于 3094 毫秒,最大的响应时间小于 3184 毫秒*/
Percentage of the requests served within a certain time (ms)
  50%   3064
  66%   3094
  75%   3124
  80%   3154
  90%   3184
  95%   3184
  98%   3184
  99%   3184
 100%   3184 (longest request)

21/212>
《2023软件测试行业现状调查报告》独家发布~

关注51Testing

联系我们

快捷面板 站点地图 联系我们 广告服务 关于我们 站长统计 发展历程

法律顾问:上海兰迪律师事务所 项棋律师
版权所有 上海博为峰软件技术股份有限公司 Copyright©51testing.com 2003-2024
投诉及意见反馈:webmaster@51testing.com; 业务联系:service@51testing.com 021-64471599-8017

沪ICP备05003035号

沪公网安备 31010102002173号