<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<!--
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
This file is generated from xml source: DO NOT EDIT
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
-->
<title>ab - Apache HTTP server benchmarking tool - Apache HTTP Server Version 2.5</title>
<link href="/style/css/manual.css" rel="stylesheet" media="all" type="text/css" title="Main stylesheet" />
<link href="/style/css/manual-loose-100pc.css" rel="alternate stylesheet" media="all" type="text/css" title="No Sidebar - Default font size" />
<link href="/style/css/manual-print.css" rel="stylesheet" media="print" type="text/css" /><link rel="stylesheet" type="text/css" href="/style/css/prettify.css" />
</script>
<body id="manual-page"><div id="page-header">
<p class="menu"><a href="/mod/">Modules</a> | <a href="/mod/quickreference.html">Directives</a> | <a href="http://wiki.apache.org/httpd/FAQ">FAQ</a> | <a href="/glossary.html">Glossary</a> | <a href="/sitemap.html">Sitemap</a></p>
<p class="apache">Apache HTTP Server Version 2.5</p>
<div id="path">
<a href="http://www.apache.org/">Apache</a> > <a href="http://httpd.apache.org/">HTTP Server</a> > <a href="http://httpd.apache.org/docs/">Documentation</a> > <a href="../">Version 2.5</a> > <a href="./">Programs</a></div><div id="page-content"><div id="preamble"><h1>ab - Apache HTTP server benchmarking tool</h1>
<div class="toplang">
<p><span>Available Languages: </span><a href="/en/programs/ab.html" title="English"> en </a> |
</div>
<p><code>ab</code> 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.</p>
</div>
<div id="quickview"><ul id="toc"><li><img alt="" src="/images/down.gif" /> <a href="#synopsis">Synopsis</a></li>
</ul><h3>See also</h3><ul class="seealso"><li><code class="program"><a href="/programs/httpd.html">httpd</a></code></li></ul><ul class="seealso"><li><a href="#comments_section">Comments</a></li></ul></div>
<div class="section">
<h2><a name="synopsis" id="synopsis">Synopsis</a></h2>
<p><code><strong>ab</strong>
[ -<strong>A</strong> <var>auth-username</var>:<var>password</var> ]
[ -<strong>b</strong> <var>windowsize</var> ]
[ -<strong>B</strong> <var>local-address</var> ]
[ -<strong>c</strong> <var>concurrency</var> ]
[ -<strong>C</strong> <var>cookie-name</var>=<var>value</var> ]
[ -<strong>d</strong> ]
[ -<strong>e</strong> <var>csv-file</var> ]
[ -<strong>f</strong> <var>protocol</var> ]
[ -<strong>g</strong> <var>gnuplot-file</var> ]
[ -<strong>h</strong> ]
[ -<strong>H</strong> <var>custom-header</var> ]
[ -<strong>i</strong> ]
[ -<strong>k</strong> ]
[ -<strong>l</strong> ]
[ -<strong>m</strong> <var>HTTP-method</var> ]
[ -<strong>n</strong> <var>requests</var> ]
[ -<strong>p</strong> <var>POST-file</var> ]
[ -<strong>P</strong> <var>proxy-auth-username</var>:<var>password</var> ]
[ -<strong>q</strong> ]
[ -<strong>r</strong> ]
[ -<strong>s</strong> <var>timeout</var> ]
[ -<strong>S</strong> ]
[ -<strong>t</strong> <var>timelimit</var> ]
[ -<strong>T</strong> <var>content-type</var> ]
[ -<strong>u</strong> <var>PUT-file</var> ]
[ -<strong>v</strong> <var>verbosity</var>]
[ -<strong>V</strong> ]
[ -<strong>w</strong> ]
[ -<strong>x</strong> <var><table>-attributes</var> ]
[ -<strong>X</strong> <var>proxy</var>[:<var>port</var>] ]
[ -<strong>y</strong> <var><tr>-attributes</var> ]
[ -<strong>z</strong> <var><td>-attributes</var> ]
[ -<strong>Z</strong> <var>ciphersuite</var> ]
[http[s]://]<var>hostname</var>[:<var>port</var>]/<var>path</var></code></p>
<div class="section">
<h2><a name="options" id="options">Options</a></h2>
<dl>
<dt><code>-A <var>auth-username</var>:<var>password</var></code></dt>
<dd>Supply BASIC Authentication credentials to the server. The username and
password are separated by a single <code>:</code> and sent on the wire
base64 encoded. The string is sent regardless of whether the server needs
<dt><code>-b <var>windowsize</var></code></dt>
<dt><code>-B <var>local-address</var></code></dt>
<dd>Address to bind to when making outgoing connections.</dd>
<dt><code>-c <var>concurrency</var></code></dt>
<dd>Number of multiple requests to perform at a time. Default is one
request at a time.</dd>
<dt><code>-C <var>cookie-name</var>=<var>value</var></code></dt>
<dd>Add a <code>Cookie:</code> line to the request. The argument is
typically in the form of a <code><var>name</var>=<var>value</var></code>
pair. This field is repeatable.</dd>
<dt><code>-d</code></dt>
<dd>Do not display the "percentage served within XX [ms] table". (legacy
support).</dd>
<dt><code>-e <var>csv-file</var></code></dt>
<dd>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'.</dd>
<dt><code>-f <var>protocol</var></code></dt>
TLS1.1 and TLS1.2 support available in 2.4.4 and later.</dd>
<dt><code>-g <var>gnuplot-file</var></code></dt>
<dd>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. </dd>
<dt><code>-h</code></dt>
<dd>Display usage information.</dd>
<dt><code>-H <var>custom-header</var></code></dt>
<dd>Append extra headers to the request. The argument is typically in
the form of a valid header line, containing a colon-separated field-value
<dt><code>-i</code></dt>
<dd>Do <code>HEAD</code> requests instead of <code>GET</code>.</dd>
<dt><code>-k</code></dt>
requests within one HTTP session. Default is no KeepAlive.</dd>
<dt><code>-l</code></dt>
<dd>Do not report errors if the length of the responses is not constant. This
can be usefull for dynamic pages.<br />
Available in 2.4.7 and later.
</dd>
<dt><code>-m <var>HTTP-method</var></code></dt>
<dd>Custom HTTP method for the requests.<br />
Available in 2.4.10 and later.</dd>
<dt><code>-n <var>requests</var></code></dt>
<dd>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.</dd>
<dt><code>-p <var>POST-file</var></code></dt>
<dd>File containing data to POST. Remember to also set <code>-T</code>.</dd>
<dt><code>-P <var>proxy-auth-username</var>:<var>password</var></code></dt>
<dd>Supply BASIC Authentication credentials to a proxy en-route. The
username and password are separated by a single <code>:</code> and sent on
the wire base64 encoded. The string is sent regardless of whether the
needed).</dd>
<dt><code>-q</code></dt>
<dd>When processing more than 150 requests, <code>ab</code> outputs a
progress count on <code>stderr</code> every 10% or 100 requests or so. The
<code>-q</code> flag will suppress these messages.</dd>
<dt><code>-r</code></dt>
<dd>Don't exit on socket receive errors.</dd>
<dt><code>-s <var>timeout</var></code></dt>
<dd>Maximum number of seconds to wait before the socket times out.
Default is 30 seconds.<br />
Available in 2.4.4 and later.</dd>
<dt><code>-S</code></dt>
<dd>Do not display the median and standard deviation values, nor display
one or two times the standard deviation apart. And default to the
<dt><code>-t <var>timelimit</var></code></dt>
<dd>Maximum number of seconds to spend for benchmarking. This implies a
<code>-n 50000</code> internally. Use this to benchmark the server within a
fixed total amount of time. Per default there is no timelimit.</dd>
<dt><code>-T <var>content-type</var></code></dt>
<dt><code>-u <var>PUT-file</var></code></dt>
<dd>File containing data to PUT. Remember to also set <code>-T</code>.</dd>
<dt><code>-v <var>verbosity</var></code></dt>
<dd>Set verbosity level - <code>4</code> and above prints information on
headers, <code>3</code> and above prints response codes (404, 200, etc.),
<code>2</code> and above prints warnings and info.</dd>
<dt><code>-V</code></dt>
<dd>Display version number and exit.</dd>
<dt><code>-w</code></dt>
<dd>Print out results in HTML tables. Default table is two columns wide,
with a white background.</dd>
<dt><code>-x <var><table>-attributes</var></code></dt>
<dd>String to use as attributes for <code><table></code>. Attributes
are inserted <code><table <var>here</var> ></code>.</dd>
<dt><code>-X <var>proxy</var>[:<var>port</var>]</code></dt>
<dd>Use a proxy server for the requests.</dd>
<dt><code>-y <var><tr>-attributes</var></code></dt>
<dd>String to use as attributes for <code><tr></code>.</dd>
<dt><code>-z <var><td>-attributes</var></code></dt>
<dd>String to use as attributes for <code><td></code>.</dd>
<dt><code>-Z <var>ciphersuite</var></code></dt>
</dl>
<div class="section">
<h2><a name="output" id="output">Output</a></h2>
<p>The following list describes the values returned by <code>ab</code>:
</p>
<dl>
<dt>Server Software</dt>
<dd>The value, if any, returned in the <var>server</var> HTTP header
of the first successful response. This includes all characters in the
header from beginning to the point a character with decimal value of 32
<dt>Server Hostname</dt>
<dd>The DNS or IP address given on the command line</dd>
<dt>Server Port</dt>
<dd>The port to which ab is connecting. If no port is given on the
command line, this will default to 80 for http and 443 for
https.</dd>
<dd>The protocol parameters negotiated between the client and server.
This will only be printed if SSL is used.</dd>
<dt>Document Path</dt>
<dd>The request URI parsed from the command line string.</dd>
<dt>Document Length</dt>
<dd>This is the size in bytes of the first successfully returned document.
If the document length changes during testing, the response is
considered an error.</dd>
<dt>Concurrency Level</dt>
<dd>The number of concurrent clients used during the test</dd>
<dt>Time taken for tests</dt>
<dd>This is the time taken from the moment the first socket connection
is created to the moment the last response is received</dd>
<dt>Complete requests</dt>
<dd>The number of successful responses received</dd>
<dt>Failed requests</dt>
<dd>The number of requests that were considered a failure. If the
number is greater than zero, another line will be printed showing the
number of requests that failed due to connecting, reading, incorrect
content length, or exceptions.</dd>
<dt>Write errors</dt>
<dd>The number of errors that failed during write (broken pipe).</dd>
<dt>Non-2xx responses</dt>
<dd>The number of responses that were not in the 200 series of response
codes. If all responses were 200, this field is not printed.</dd>
<dt>Keep-Alive requests</dt>
<dd>The number of connections that resulted in Keep-Alive requests</dd>
<dt>Total body sent</dt>
<dd>If configured to send data as part of the test, this is the total
number of bytes sent during the tests. This field is omitted if the test
did not include a body to send.</dd>
<dt>Total transferred</dt>
<dd>The total number of bytes received from the server. This number
is essentially the number of bytes sent over the wire.</dd>
<dt>HTML transferred</dt>
<dd>The total number of document bytes received from the server. This
number excludes bytes received in HTTP headers</dd>
<dt>Requests per second</dt>
<dd>This is the number of requests per second. This value is the result
of dividing the number of requests by the total time taken</dd>
<dt>Time per request</dt>
<dd>The average time spent per request. The first value is calculated
with the formula <code>concurrency * timetaken * 1000 / done</code>
while the second value is calculated with the formula
<code>timetaken * 1000 / done</code></dd>
<dt>Transfer rate</dt>
<dd>The rate of transfer as calculated by the formula
<code>totalread / 1024 / timetaken</code></dd>
</dl>
<div class="section">
<h2><a name="bugs" id="bugs">Bugs</a></h2>
<p>There are various statically declared buffers of fixed length. Combined
with the lazy parsing of the command line arguments, the response headers
from the server and other external inputs, this might bite you.</p>
of responses. The rather heavy use of <code>strstr(3)</code> shows up top
would measure the <code>ab</code> performance rather than the server's.</p>
</div></div>
<div class="bottomlang">
<p><span>Available Languages: </span><a href="/en/programs/ab.html" title="English"> en </a> |
</div><div class="top"><a href="#page-header"><img src="/images/up.gif" alt="top" /></a></div><div class="section"><h2><a id="comments_section" name="comments_section">Comments</a></h2><div class="warning"><strong>Notice:</strong><br />This is not a Q&A section. Comments placed here should be pointed towards suggestions on improving the documentation or server, and may be removed again by our moderators if they are either implemented or considered invalid/off-topic. Questions on how to manage the Apache HTTP Server should be directed at either our IRC channel, #httpd, on Freenode, or sent to our <a href="http://httpd.apache.org/lists.html">mailing lists</a>.</div>
var comments_shortname = 'httpd';
var comments_identifier = 'http://httpd.apache.org/docs/trunk/programs/ab.html';
(function(w, d) {
if (w.location.hostname.toLowerCase() == "httpd.apache.org") {
d.write('<div id="comments_thread"><\/div>');
var s = d.createElement('script');
s.type = 'text/javascript';
s.async = true;
s.src = 'https://comments.apache.org/show_comments.lua?site=' + comments_shortname + '&page=' + comments_identifier;
(d.getElementsByTagName('head')[0] || d.getElementsByTagName('body')[0]).appendChild(s);
}
else {
d.write('<div id="comments_thread">Comments are disabled for this page at the moment.<\/div>');
}
})(window, document);
//--><!]]></script></div><div id="footer">
<p class="apache">Copyright 2015 The Apache Software Foundation.<br />Licensed under the <a href="http://www.apache.org/licenses/LICENSE-2.0">Apache License, Version 2.0</a>.</p>
<p class="menu"><a href="/mod/">Modules</a> | <a href="/mod/quickreference.html">Directives</a> | <a href="http://wiki.apache.org/httpd/FAQ">FAQ</a> | <a href="/glossary.html">Glossary</a> | <a href="/sitemap.html">Sitemap</a></p></div><script type="text/javascript"><!--//--><![CDATA[//><!--
if (typeof(prettyPrint) !== 'undefined') {
prettyPrint();
}
//--><!]]></script>
</body></html>