A8DOG

A8DOG

随便写写,记录折腾过程!
telegram

Web performance stress testing tool for Mac: ab (ApacheBench)

Mac comes with Apache installed, check the version:

apachectl -v

Check the version of ab:

ab -V

To learn how to use the ab stress testing tool, check:

ab --help

man ab

Now, let's take requesting Baidu as an example:

ab -n 100 -c 10 https://www.baidu.com/

ab -n requests -c concurrency URL

Common commands:
-n requests: number of requests to perform
-c concurrency: number of multiple requests to make at a time
-t timelimit: seconds to max. time to spend on benchmarking - implies -n 50000
-s timeout: seconds to max. time to 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, e.g. '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, e.g. 'Apache=1234'. (repeatable)
-H attribute: add arbitrary header line, e.g. '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 more than 150 requests
-l accept variable document length (useful for dynamic pages)
-g filename: gnuplot output file
-e filename: output CSV file with percentages served
-r don't exit on socket receive errors.
-m method: method name
-h display usage information (this message)
-I disable TLS Server Name Indication (SNI) extension
-Z ciphersuite: specify SSL/TLS cipher suite (See openssl ciphers)
-f protocol: specify SSL/TLS protocol (TLS1, TLS1.1, TLS1.2 or ALL)
-E certfile: specify optional client certificate chain and private key.

Loading...
Ownership of this post data is guaranteed by blockchain and smart contracts to the creator alone.