ab(apache bench)是apache下的一个工具,主要用于对web站点做压力测试,


[dev@web ~]$ ab -c 20 -n 50000 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 (be patient)Completed 5000 requestsCompleted 10000 requestsCompleted 15000 requestsCompleted 20000 requestsCompleted 25000 requestsCompleted 30000 requestsCompleted 35000 requestsCompleted 40000 requestsCompleted 45000 requestsCompleted 50000 requestsFinished 50000 requestsServer Software: nginx/1.6.2Server Hostname: Port: 80Document Path: /Document Length: 41005 bytes # 请求的页面大小Concurrency Level: 20 # 并发量Time taken for tests: 1180.733 seconds # 测试总共耗时Complete requests: 50000 # 完成的请求Failed requests: 0 # 失败的请求Write errors: 0 # 错误Total transferred: 2067550000 bytes # 总共传输数据量HTML transferred: 2050250000 bytesRequests per second: 42.35 [#/sec] (mean) # 每秒钟的请求量。(仅仅是测试页面的响应速度)Time per request: 472.293 [ms] (mean) # 等于 Time taken for tests/(complete requests/concurrency level) 即平均请求等待时间(用户等待的时间)Time per request: 23.615 [ms] (mean, across all concurrent requests) # 等于 Time taken for tests/Complete requests 即服务器平均请求响应时间 在并发量为1时 用户等待时间相同Transfer rate: 1710.03 [Kbytes/sec] received # 平均每秒多少K,即带宽速率Connection Times (ms)min mean[+/-sd] median maxConnect: 0 1 18.5 0 1001Processing: 38 471 534.1 155 9269Waiting: 37 456 524.6 147 9259Total: 40 472 534.5 155 9269Percentage of the requests served within a certain time (ms)50% 15566% 57175% 78380% 87190% 121195% 160398% 183999% 2003100% 9269 (longest request)

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
-t timelimit Seconds to max. wait for responses
-b windowsize Size of TCP send/receive buffer, in bytes #
-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 for POSTing, eg.
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.
-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 (SSL2, SSL3, TLS1, or ALL)


原创文章,作者:zhang sir,如若转载,请注明出处:https://www.ysidc.top/8998.html