AB压力测试工具

1.安装AB工具:html

yum install httpd-tools

2.测试:nginx

ab -n 100 -c 10 http://localhost.com/

其中-n表示请求数,-c表示并发数web

3.测试结果apache

[root@vijay01 ~]# ab -c 10 -n 1000 http://192.168.2.11/ab.html
This is ApacheBench, Version 2.3 <$Revision: 655654 $>
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Licensed to The Apache Software Foundation, http://www.apache.org/

Benchmarking 192.168.2.11 (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
Completed 1000 requests
Finished 1000 requests


Server Software:        nginx/1.0.15
Server Hostname:        192.168.2.11
Server Port:            80

Document Path:          /ab.html
Document Length:        3698 bytes

Concurrency Level:      10
Time taken for tests:   0.105 seconds
Complete requests:      1000
Failed requests:        0
Write errors:           0
Total transferred:      3910000 bytes
HTML transferred:       3698000 bytes
Requests per second:    9515.20 [#/sec] (mean)
Time per request:       1.051 [ms] (mean)
Time per request:       0.105 [ms] (mean, across all concurrent requests)
Transfer rate:          36332.46 [Kbytes/sec] received

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

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

--------------------------------------------------------------------------------------------------------------------服务器

Server Software:        nginx/1.0.15
Server Hostname:        192.168.2.11
Server Port:            80
  • 这段展现的是web服务器的信息,能够看到服务器采用的是nginx,域名是wan.bigertech.com,端口是80
Document Path:          /ab.html
Document Length:        3698 bytes
  • 这段是关于请求的文档的相关信息,所在位置“/”,文档的大小为338436 bytes(此为http响应的正文长度)

------------------------------------------------------------------------------------------------------------------网络

Concurrency Level:      10
Time taken for tests:   0.105 seconds
Complete requests:      1000
Failed requests:        0
Write errors:           0
Total transferred:      3910000 bytes
HTML transferred:       3698000 bytes
Requests per second:    9515.20 [#/sec] (mean)
Time per request:       1.051 [ms] (mean)
Time per request:       0.105 [ms] (mean, across all concurrent requests)
Transfer rate:          36332.46 [Kbytes/sec] received
  • 这段展现了压力测试的几个重要指标

  Concurrency Level: 100           --并发请求数
  Time taken for tests: 50.872 seconds   --整个测试持续的时间
  Complete requests: 1000          --完成的请求数
  Failed requests: 0                 --失败的请求数并发

  Total transferred: 13701482 bytes      --整个场景中的网络传输量
  HTML transferred: 13197000 bytes     --整个场景中的HTML内容传输量工具

Requests per second: 19.66 [#/sec] (mean)     --吞吐率,你们最关心的指标之一,至关于 LR 中的每秒事务数,后面括号中的 mean 表示这是一个平均值
Time per request: 5087.180 [ms] (mean)          --用户平均请求等待时间,你们最关心的指标之二,至关于 LR 中的平均事务响应时间,后面括号中的 mean 表示这是一个平均值
Time per request: 50.872 [ms] (mean, across all concurrent requests)    --服务器平均请求处理时间,你们最关心的指标之三
测试

Transfer rate: 263.02 [Kbytes/sec] received             --平均每秒网络上的流量,能够帮助排除是否存在网络流量过大致使响应时间延长的问题spa

-----------------------------------------------------------------------------------------------------

Connection Times (ms) min  mean[+/-sd] median   max
Connect:               0    0   0.2      0       2
Processing:         0    1   0.5      1       3
Waiting:            0    1   0.4      1       2
Total:              0    1   0.5      1       5
  • 这段表示网络上消耗的时间的分解

------------------------------------------------------------------------------------------------------

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

  

  • 这段是每一个请求处理时间的分布状况,50%的处理时间在4930ms内,66%的处理时间在5008ms内...,重要的是看90%的处理时间。
相关文章
相关标签/搜索