apache ab压力测试工具---linux(ubuntu)

linux下打开ab的man页面,介绍如下:

NAME
       ab - Apache HTTP server benchmarking tool

SYNOPSIS
       ab [ -A auth-username:password ] [ -b windowsize ] [ -c concurrency ] [ -C cookie-name=value ] [ -d ] [ -e csv-file ] [ -f protocol ] [ -g gnuplot-file ] [ -h ] [ -H custom-header
       ] [ -i ] [ -k ] [ -n requests ] [ -p POST-file ] [ -P proxy-auth-username:password ] [ -q ] [ -r ] [ -s ] [ -S ] [ -t timelimit ] [ -T content-type ] [ -u PUT-file  ]  [  -v  ver?
       bosity] [ -V ] [ -w ] [ -x <table>-attributes ] [ -X proxy[:port] ] [ -y <tr>-attributes ] [ -z <td>-attributes ] [ -Z ciphersuite ] [http[s]://]hostname[:port]/path

SUMMARY
       ab  is  a  tool  for benchmarking your Apache Hypertext Transfer Protocol (HTTP) server. It is designed to give you an impression of how your current Apache installation performs.
       This especially shows you how many requests per second your Apache installation is capable of serving.

每个参数的介绍,网上已经有很多了,比较实用使用的2个参数是 

-c   并发连接数

-n  请求总数

Options are:
    -n requests     Number of requests to perform
    -c concurrency  Number of multiple requests to make
使用这2个参数分别对一个weblogic服务器和nginx进行简单测试,可以看出简单的区别

以下是使用ab对淘宝的nginx服务器(tengine)进行测试的结果:

dwj@suyi:~$ ab  -c 100 -n 1000 http://192.168.7.15/xxhfgz/
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.7.15 (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:        Tengine/2.0.1
Server Hostname:        192.168.7.15
Server Port:            80

Document Path:          /xxhfgz/
Document Length:        17416 bytes

Concurrency Level:      100
Time taken for tests:   11.452 seconds
Complete requests:      1000
Failed requests:        0
Write errors:           0
Total transferred:      17714000 bytes
HTML transferred:       17416000 bytes
Requests per second:    87.32 [#/sec] (mean)                               #这个很关键,服务器每秒处理的请求数--可以简单理解为负载能力
Time per request:       1145.234 [ms] (mean)                               #每个请求用户等待的时间
Time per request:       11.452 [ms] (mean, across all concurrent requests)
Transfer rate:          1510.51 [Kbytes/sec] received

Connection Times (ms)
              min  mean[+/-sd] median   max
Connect:        0    3   4.6      1      48
Processing:    49 1095 193.9   1161    1221
Waiting:       49 1092 196.6   1159    1216
Total:         60 1098 191.8   1163    1222

Percentage of the requests served within a certain time (ms)
  50%   1163             #请求时间1163ms以下的占50%
  66%   1173             #请求时间1173ms以下的占66%
  75%   1178
  80%   1181
  90%   1188
  95%   1194
  98%   1203
  99%   1206
 100%   1222 (longest request)

以下是直接对weblogic服务器进行测试结果:

dwj@suyi:~$ ab  -c 100 -n 1000 http://192.168.7.15:7003/xxhfgz/
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.7.15 (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:        
Server Hostname:        192.168.7.15
Server Port:            7003

Document Path:          /xxhfgz/
Document Length:        17416 bytes

Concurrency Level:      100
Time taken for tests:   18.351 seconds
Complete requests:      1000
Failed requests:        0
Write errors:           0
Total transferred:      17668000 bytes
HTML transferred:       17416000 bytes
Requests per second:    54.49 [#/sec] (mean)
Time per request:       1835.124 [ms] (mean)
Time per request:       18.351 [ms] (mean, across all concurrent requests)
Transfer rate:          940.20 [Kbytes/sec] received

Connection Times (ms)
              min  mean[+/-sd] median   max
Connect:        0    4   8.8      1      74
Processing:    54 1768 290.3   1816    2358
Waiting:       52 1766 289.9   1814    2357
Total:         90 1772 284.9   1817    2378

Percentage of the requests served within a certain time (ms)
  50%   1817
  66%   1847
  75%   1887
  80%   1905
  90%   1931
  95%   2041
  98%   2247
  99%   2301
 100%   2378 (longest request)



  • 0
    点赞
  • 4
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值