Synopsis
Apache Bench (ab) is a tool from the Apache organization for benchmarking a Hypertext Transfer Protocol (HTTP) web server. Although it is designed to measure the performance of Apache web server, yet it can also be used to test any other web server that is equally good.
ab [-Aauth-username:password ] [ -bwindowsize ] [ -cconcurrency ] [-Ccookie-name=value ] [ -d ] [-ecsv-file ] [ -fprotocol ] [-ggnuplot-file ] [ -h ] [ -Hcustom-header ] [ -i ] [ -k ] [-nrequests ] [ -pPOST-file ] [-Pproxy-auth-username:password ] [-q ] [ -r ] [ -s ] [ -S ] [-ttimelimit ] [ -Tcontent-type] [ -uPUT-file ] [ -vverbosity] [ -V ] [ -w ] [ -x<table>-attributes ] [ -Xproxy[:port] ] [ -y<tr>-attributes ] [ -z<td>-attributes ] [ -Zciphersuite ][http[s]://]hostname[:port]/path
- Apache bin ab.exe The recommended installation in Windows is to use Xampp or similar software, but that is the raw Apache HTTP Server installation.
- High Definition Plasma Cutting Tables 200 AMP 5 X 10 ALM Cutting Plasma Table (Up to 1.25″) 200 AMP Plasma with Side Tube Rotator (2″ Carbon, 1″ SS, & SCH 120 6″).
add an example, a script, a trick and tips
examples
options
-Aauth-username:password
Supply BASIC Authenticationcredentials to the server. The username and password areseparated by a single : and sent on the wire base64 encoded.The string is sent regardless of whether the server needs it(i.e., has sent an 401 authentication needed).
-b windowsize
Size of TCP send/receivebuffer, in bytes.
-c concurrency
Number of multiple requests toperform at a time. Default is one request at a time.
-Ccookie-name=value
Add a Cookie: line to therequest. The argument is typically in the form of aname=value pair. This field is repeatable.
-d
Do not display the 'percentage served within XX[ms] table'. (legacy support).
-e csv-file
Write a Comma separated value(CSV) file which contains for each percentage (from 1% to100%) the time (in milliseconds) it took to serve thatpercentage of the requests. This is usually more useful thanthe ’gnuplot’ file; as the results are already’binned’.
-f protocol
Specify SSL/TLS protocol (SSL2,SSL3, TLS1, or ALL).
-g gnuplot-file
Write all measured values outas a ’gnuplot’ or TSV (Tab separate values)file. This file can easily be imported into packages likeGnuplot, IDL, Mathematica, Igor or even Excel. The labelsare on the first line of the file.
-h
Display usage information.
-H custom-header
Append extra headers to therequest. The argument is typically in the form of a validheader line, containing a colon-separated field-value pair(i.e., 'Accept-Encoding:zip/zop;8bit').
-i
Do HEAD requests instead of GET.
-k
Enable the HTTP KeepAlive feature, i.e., performmultiple requests within one HTTP session. Default is noKeepAlive.
-n requests
Number of requests to performfor the benchmarking session. The default is to just performa single request which usually leads to non-representativebenchmarking results.
-p POST-file
File containing data to POST.Remember to also set -T.
-Pproxy-auth-username:password
Supply BASIC Authenticationcredentials to a proxy en-route. The username and passwordare separated by a single : and sent on the wire base64encoded. The string is sent regardless of whether the proxyneeds it (i.e., has sent an 407 proxy authenticationneeded).
-q
When processing more than 150 requests, ab outputs aprogress count on stderr every 10% or 100 requests or so.The -q flag will suppress these messages.
-r
Don’t exit on socket receive errors.
-s
When compiled in (ab -h will show you) use the SSLprotected https rather than the http protocol. This featureis experimental and very rudimentary. You probably donot want to use it.
-S
Do not display the median and standard deviation values,nor display the warning/error messages when the average andmedian are more than one or two times the standard deviationapart. And default to the min/avg/max values. (legacysupport).
-t timelimit
Maximum number of seconds tospend for benchmarking. This implies a -n 50000 internally.Use this to benchmark the server within a fixed total amountof time. Per default there is no timelimit.
-T content-type
Content-type header to use forPOST/PUT data, eg. application/x-www-form-urlencoded.Default: text/plain.
-u PUT-file
Can%27t delete items in note. File containing data to PUT.Remember to also set -T.
-v verbosity
Set verbosity level - 4 andabove prints information on headers, 3 and above printsresponse codes (404, 200, etc.), 2 and above prints warningsand info.
-V
Display version number and exit.
-w
Tagspaces vs. Print out results in HTML tables. Default table is twocolumns wide, with a white background.
-x<table>-attributes
String to use as attributes for<table>. Attributes are inserted <table here>.
-Xproxy[:port]
Use a proxy server for therequests.
-y<tr>-attributes
String to use as attributes for<tr>.
-z<td>-attributes
String to use as attributes for<td>.
-Z ciphersuite
Apache Abs Pipe Failures Pictures
Specify SSL/TLS cipher suite(See openssl ciphers).
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.
Apache Ab
bugs
There arevarious statically declared buffers of fixed length.Combined with the lazy parsing of the command linearguments, the response headers from the server and otherexternal inputs, this might bite you.
Apache Ab Example
It does notimplement HTTP/1.x fully; only accepts some’expected’ forms of responses. The rather heavyuse of strstr(3) shows up top in profile, which mightindicate a performance problem; i.e., you wouldmeasure the ab performance rather than theserver’s.