ab命令Web压力测试工具

效率工具 盛行 5年前 (2015-12-08) 307次浏览 已收录 0个评论 扫描二维码
文章目录
[隐藏]

1.释义

Web压力测试工具

2.系统帮助

ab: wrong number of arguments
Usage: ab [options] [http[s]://]hostname[:port]/path
Options are:
    -n requests     要执行的请求次数
    -c concurrency  并发请求数
    -t timelimit    Seconds to max. to spend on benchmarking
                    This implies -n 50000
    -s timeout      Seconds to max. wait for each response
                    Default is 30 seconds
    -b windowsize   Size of TCP send/receive buffer, in bytes
    -B address      Address to bind to when making outgoing connections
    -p postfile     File containing data to POST. Remember also to set -T
    -u putfile      File containing data to PUT. Remember also to set -T
    -T content-type Content-type header to use for POST/PUT data, eg.
                    'application/x-www-form-urlencoded'
                    Default is 'text/plain'
    -v verbosity    How much troubleshooting info to print
    -w              Print out results in HTML tables
    -i              Use HEAD instead of GET
    -x attributes   String to insert as table attributes
    -y attributes   String to insert as tr attributes
    -z attributes   String to insert as td or th attributes
    -C attribute    Add cookie, eg. 'Apache=1234'. (repeatable)
    -H attribute    Add Arbitrary header line, eg. 'Accept-Encoding: gzip'
                    Inserted after all normal header lines. (repeatable)
    -A attribute    Add Basic WWW Authentication, the attributes
                    are a colon separated username and password.
    -P attribute    Add Basic Proxy Authentication, the attributes
                    are a colon separated username and password.
    -X proxy:port   Proxyserver and port number to use
    -V              Print version number and exit
    -k              Use HTTP KeepAlive feature
    -d              Do not show percentiles served table.
    -S              Do not show confidence estimators and warnings.
    -q              Do not show progress when doing more than 150 requests
    -g filename     Output collected data to gnuplot format file.
    -e filename     Output CSV file with percentages served
    -r              Don't exit on socket receive errors.
    -h              Display usage information (this message)
    -Z ciphersuite  Specify SSL/TLS cipher suite (See openssl ciphers)
    -f protocol     Specify SSL/TLS protocol
                    (SSL3, TLS1, TLS1.1, TLS1.2 or ALL)

3.示例

3.1.压力测试

[root@itbkz ~]#ab -c 100 -n 100 https://www.baidu.com/
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 www.baidu.com (be patient).....done


Server Software:        BWS/1.1
Server Hostname:        www.baidu.com
Server Port:            443
SSL/TLS Protocol:       TLSv1.2,ECDHE-RSA-AES128-GCM-SHA256,2048,128

Document Path:          /
Document Length:        227 bytes

Concurrency Level:      100
Time taken for tests:   0.417 seconds
Complete requests:      100
Failed requests:        0
Write errors:           0
Total transferred:      108175 bytes
HTML transferred:       22700 bytes
Requests per second:    239.94 [#/sec] (mean)
Time per request:       416.765 [ms] (mean)
Time per request:       4.168 [ms] (mean, across all concurrent requests)
Transfer rate:          253.48 [Kbytes/sec] received

Connection Times (ms)
              min  mean[+/-sd] median   max
Connect:       38  205  60.0    251     265
Processing:    22   68  56.2     24     231
Waiting:       11   58  52.0     20     231
Total:         63  273  23.6    274     365

Percentage of the requests served within a certain time (ms)
  50%    274
  66%    275
  75%    276
  80%    276
  90%    280
  95%    286
  98%    292
  99%    365
 100%    365 (longest request)
请勿非法攻击

IT博客站版权所有丨如未注明 , 均为原创丨本网站采用BY-NC-SA协议进行授权
转载请注明原文链接:ab命令Web压力测试工具
喜欢 (0)
[使用支付宝扫码]
分享 (0)
盛行
关于作者:
企业应用技术爱好者,喜欢分享知识。如果文章中有错误,欢迎指正,谢谢。
发表我的评论
取消评论
表情 贴图 加粗 删除线 居中 斜体 签到

Hi,您需要填写昵称和邮箱!

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址