速查表之ab并发测试

Linux下 安装ab测试工具

$ yum -y install httpd-tools
$ ab -n 1 -c 1 http://localhost:18002/
$ ab   -H 'authenticate: 111'  -n  1 -c 1 http://192.168.0.4:18002/lottery

请求URL要使用双引号括起来,否则ab无法识别&符号

-n:总请求次数(最小默认为1)

-c:并发次数(最小默认为1且不能大于总请求次数,如:100个请求,10个并发,实际就是1人请求10次)

-p:post参数文档路径(-p和-T参数要配合使用)

-T:header头内容类型(此处切记是大写英文字母T)

$ ab -H 'authenticate: 111'  -n  1 -c 1 -p ab_post.json -T application/json  http://192.168.0.246:8092/lottery
{
        "scence":"room",
        "scence_id":605021,
        "times":1
}
This is ApacheBench, Version 2.3 <$Revision: 1430300 $>
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Licensed to The Apache Software Foundation, http://www.apache.org/

Benchmarking localhost (be patient).....done


Server Software:
Server Hostname:        localhost
Server Port:            18002

#请求的资源
Document Path:          /
#文档返回的长度,不包括相应的头
Document Length:        5 bytes

#并发数 等于 -c 设置的值
Concurrency Level:      10
#总请求时长
Time taken for tests:   0.073 seconds
#总请求数 等于 -n 设置的值
Complete requests:      10
#失败的请求数
Failed requests:        0
#错误
Write errors:           0
#总共传输数据量
Total transferred:      2780 bytes
HTML transferred:       50 bytes
 #平均每秒的请求数,重要指标:相当于LR中的每秒事务数,后面的括号中mean表示这是一个平均值
Requests per second:    137.41 [#/sec] (mean)
#平均每个请求消耗的时间,重要指标:LR中的平均事务响应时间
Time per request:       72.773 [ms] (mean)
#上面的请求除以并发数,即服务器平均请求响应时间 在并发量为1时 用户等待时间相同
Time per request:       7.277 [ms] (mean, across all concurrent requests)
#平均每秒多少K,即传输速率
Transfer rate:          37.31 [Kbytes/sec] received

Connection Times (ms)
              min  mean[+/-sd] median   max
Connect:        0    0   0.0      0       0
Processing:     8   36  20.8     41      65
Waiting:        7   36  20.9     41      65
Total:          8   36  20.8     41      65

Percentage of the requests served within a certain time (ms)
  50%     41      #50%的请求都在41ms内完成
  66%     48
  75%     54
  80%     59
  90%     65
  95%     65
  98%     65
  99%     65
 100%     65 (longest request)
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值