ab压力测试工具

Posted 我的紫霞辣辣

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了ab压力测试工具相关的知识,希望对你有一定的参考价值。

  • 安装ab压力测试工具
yum install httpd-tools
  • ab命令使用格式及其常用的参数
ab -n 50 -c 20 http://192.168.15.7/download/

-n : 总的请求数
-c : 同时并发的请求数
  • 压力测试工具输出内容详解
[root@web02 ~]  ab -n 50 -c 20 http://192.168.15.7/download/

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 192.168.15.7 (be patient).....done


Server Software:        nginx/1.20.0
Server Hostname:        192.168.15.7
Server Port:            80

Document Path:          /download/
Document Length:        453 bytes

Concurrency Level:      20
Time taken for tests:   0.006 seconds				发费的总时间
Complete requests:      50							总共发起的请求个数
Failed requests:        44							没有来得及处理的请求个数
   (Connect: 0, Receive: 0, Length: 44, Exceptions: 0)
Write errors:           0
Non-2xx responses:      44
Total transferred:      19052 bytes
html transferred:       10330 bytes
Requests per second:    8434.55 [#/sec] (mean)				每秒请求数(总请求数除总时间)
Time per request:       2.371 [ms] (mean)					对于客户端而言,单个请求所用的时间
Time per request:       0.119 [ms] (mean, across all concurrent requests)		服务端处理请求的时间,不包括网络传输时间等
Transfer rate:          3138.57 [Kbytes/sec] received				网络速率,可以用来当作网络瓶颈参考值

Connection Times (ms)
              min  mean[+/-sd] median   max
Connect:        0    0   0.1      0       1
Processing:     1    1   0.5      1       2
Waiting:        0    1   0.3      1       2
Total:          1    2   0.4      2       2

Percentage of the requests served within a certain time (ms)
  50%      2
  66%      2
  75%      2
  80%      2
  90%      2
  95%      2
  98%      2
  99%      2
 100%      2 (longest request)

以上是关于ab压力测试工具的主要内容,如果未能解决你的问题,请参考以下文章

Apache ab并发负载压力测试

ab(Apache Bench)压力测试工具

如何往linux中安装ab压力测试环境

Apache ab 压力并发测试工具

Apache ab 压力并发测试工具

如何使用apache自带的ab做压力测试