您的位置:首页 > 运维架构 > Nginx

ab——Apache自带的Web性能测试工具[可以用于Nginx等任何Web]

2014-08-23 15:15 471 查看
$ ab -h
Usage: ab [options] [http[s]://]hostname[:port]/path
Options are:
-n requests     Number of requests to perform
-c concurrency  Number of multiple requests to make at a time
-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
-l              Accept variable document length (use this for dynamic pages)
-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)


$ ab -n 5000 -c 100 http://localhost/ This is ApacheBench, Version 2.3 <$Revision: 1528965 $>
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)
Completed 500 requests
Completed 1000 requests
Completed 1500 requests
Completed 2000 requests
Completed 2500 requests
Completed 3000 requests
Completed 3500 requests
Completed 4000 requests
Completed 4500 requests
Completed 5000 requests
Finished 5000 requests

Server Software:        nginx/1.4.6
Server Hostname:        localhost
Server Port:            80

Document Path:          /
Document Length:        612 bytes

Concurrency Level:      100
Time taken for tests:   1.212 seconds
Complete requests:      5000
Failed requests:        0
Total transferred:      4265000 bytes
HTML transferred:       3060000 bytes
Requests per second:    4124.92 [#/sec] (mean)
Time per request:       24.243 [ms] (mean)
Time per request:       0.242 [ms] (mean, across all concurrent requests)
Transfer rate:          3436.09 [Kbytes/sec] received

Connection Times (ms)
min  mean[+/-sd] median   max
Connect:        0    1   3.6      0      37
Processing:     4   23   7.5     21      55
Waiting:        1   23   7.2     21      55
Total:         12   24   7.1     22      55

Percentage of the requests served within a certain time (ms)
50%     22
66%     24
75%     26
80%     29
90%     34
95%     37
98%     49
99%     52
100%     55 (longest request)
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: