Apache Ab

Posted on  by admin
Apache absl

Synopsis

ApacheBench (ab) – Apache Benchmark – is a single-threaded command line tool for measuring the performance of a HTTP web server. It gives you an impression of how many requests per second your server is capable of serving. Like Apache Web Server itself, it’s free, open source software and distributed under the terms of the Apache License. Jul 15, 2020 Apache Bench or ab for short, is a command-line tool to perform simple load tests on an HTTP server, be it a website or an API. By running the following command, you will get an overview of how the server is performing under load: ab -n 100 -c 10 So, in this post, I will try to explain how we can use Apache Bench. SHOP APACHE 2800. 3800 Weatherproof Protective Case - 16-5/16 In. SHOP APACHE 3800. 4800 Weatherproof Protective Case - 18 In.

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


add an example, a script, a trick and tips

examples

3

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

Apache Ab Install

Specify SSL/TLS protocol (SSL2,SSL3, TLS1, or ALL).

-g gnuplot-file

Apache

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.

Apache Ab Load Test

-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

File containing data to PUT.Remember to also set -T.

-v verbosity

Apache About

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

Print out results in HTML tables. Default table is twocolumns wide, with a white background.

-x<table>-attributes

Apache Abdera

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

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.


bugsApache

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.

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.

Options

-A auth-username:password
Supply BASIC Authentication credentials to the server. The username and password are separated 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/receive buffer, in bytes.
-B local-address
Address to bind to when making outgoing connections.
-c concurrency
Number of multiple requests to perform at a time. Default is one request at a time.
-C cookie-name=value
Add a Cookie: line to the request. The argument is typically in the form of a name=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% to 100%) the time (in milliseconds) it took to serve that percentage of the requests. This is usually more useful than the 'gnuplot' file; as the results are already 'binned'.
-E client-certificate-file
When connecting to an SSL website, use the provided client certificate in PEM format to authenticate with the server. The file is expected to contain the client certificate, followed by intermediate certificates, followed by the private key. Available in 2.4.36 and later.
-f protocol
Specify SSL/TLS protocol (SSL2, SSL3, TLS1, TLS1.1, TLS1.2, or ALL). TLS1.1 and TLS1.2 support available in 2.4.4 and later.
-g gnuplot-file
Write all measured values out as a 'gnuplot' or TSV (Tab separate values) file. This file can easily be imported into packages like Gnuplot, IDL, Mathematica, Igor or even Excel. The labels are on the first line of the file.
-h
Display usage information.
-H custom-header
Append extra headers to the request. The argument is typically in the form of a valid header 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., perform multiple requests within one HTTP session. Default is no KeepAlive.
-l
Do not report errors if the length of the responses is not constant. This can be useful for dynamic pages. Available in 2.4.7 and later.
-m HTTP-method
Custom HTTP method for the requests. Available in 2.4.10 and later.
-n requests
Number of requests to perform for the benchmarking session. The default is to just perform a single request which usually leads to non-representative benchmarking results.
-p POST-file
File containing data to POST. Remember to also set -T.
-P proxy-auth-username:password
Supply BASIC Authentication credentials to a proxy en-route. The username and password are separated by a single : and sent on the wire base64 encoded. The string is sent regardless of whether the proxy needs it (i.e., has sent an 407 proxy authentication needed).
-q
When processing more than 150 requests, ab outputs a progress 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 timeout
Maximum number of seconds to wait before the socket times out. Default is 30 seconds. Available in 2.4.4 and later.
-S
Do not display the median and standard deviation values, nor display the warning/error messages when the average and median are more than one or two times the standard deviation apart. And default to the min/avg/max values. (legacy support).
-t timelimit
Maximum number of seconds to spend for benchmarking. This implies a -n 50000 internally. Use this to benchmark the server within a fixed total amount of time. Per default there is no timelimit.
-T content-type
Content-type header to use for POST/PUT data, eg. application/x-www-form-urlencoded. Default is text/plain.
-u PUT-file
File containing data to PUT. Remember to also set -T.
-v verbosity
Set verbosity level - 4 and above prints information on headers, 3 and above prints response codes (404, 200, etc.), 2 and above prints warnings and info.
-V
Display version number and exit.
-w
Print out results in HTML tables. Default table is two columns wide, with a white background.
-x <table>-attributes
String to use as attributes for <table>. Attributes are inserted <table here >.
-X proxy[:port]
Use a proxy server for the requests.
-y <tr>-attributes
String to use as attributes for <tr>.
-z <td>-attributes
String to use as attributes for <td>.
-Z ciphersuite
Specify SSL/TLS cipher suite (See openssl ciphers)