1<?xml version="1.0" encoding="ISO-8859-1"?>
2<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
3<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en"><head><!--
4        XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
5              This file is generated from xml source: DO NOT EDIT
6        XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
7      -->
8<title>ab - Apache HTTP server benchmarking tool - Apache HTTP Server</title>
9<link href="/style/css/manual.css" rel="stylesheet" media="all" type="text/css" title="Main stylesheet" />
10<link href="/style/css/manual-loose-100pc.css" rel="alternate stylesheet" media="all" type="text/css" title="No Sidebar - Default font size" />
11<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" />
12<script src="/style/scripts/prettify.js" type="text/javascript">
13</script>
14
15<link href="/images/favicon.ico" rel="shortcut icon" /></head>
16<body id="manual-page"><div id="page-header">
17<p class="menu"><a href="/mod/">Modules</a> | <a href="/mod/directives.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>
18<p class="apache">Apache HTTP Server Version 2.2</p>
19<img alt="" src="/images/feather.gif" /></div>
20<div class="up"><a href="./"><img title="&lt;-" alt="&lt;-" src="/images/left.gif" /></a></div>
21<div id="path">
22<a href="http://www.apache.org/">Apache</a> &gt; <a href="http://httpd.apache.org/">HTTP Server</a> &gt; <a href="http://httpd.apache.org/docs/">Documentation</a> &gt; <a href="../">Version 2.2</a> &gt; <a href="./">Programs</a></div><div id="page-content"><div id="preamble"><h1>ab - Apache HTTP server benchmarking tool</h1>
23<div class="toplang">
24<p><span>Available Languages: </span><a href="/en/programs/ab.html" title="English">&nbsp;en&nbsp;</a> |
25<a href="/ko/programs/ab.html" hreflang="ko" rel="alternate" title="Korean">&nbsp;ko&nbsp;</a> |
26<a href="/tr/programs/ab.html" hreflang="tr" rel="alternate" title="T�rk�e">&nbsp;tr&nbsp;</a></p>
27</div>
28
29    <p><code>ab</code> is a tool for benchmarking your Apache Hypertext
30    Transfer Protocol (HTTP) server. It is designed to give you an impression
31    of how your current Apache installation performs. This especially shows
32    you how many requests per second your Apache installation is capable of
33    serving.</p>
34</div>
35<div id="quickview"><ul id="toc"><li><img alt="" src="/images/down.gif" /> <a href="#synopsis">Synopsis</a></li>
36<li><img alt="" src="/images/down.gif" /> <a href="#options">Options</a></li>
37<li><img alt="" src="/images/down.gif" /> <a href="#output">Description of output</a></li>
38<li><img alt="" src="/images/down.gif" /> <a href="#bugs">Bugs</a></li>
39</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>
40<div class="top"><a href="#page-header"><img alt="top" src="/images/up.gif" /></a></div>
41<div class="section">
42<h2><a name="synopsis" id="synopsis">Synopsis</a></h2>
43    <p><code><strong>ab</strong>
44    [ -<strong>A</strong> <var>auth-username</var>:<var>password</var> ]
45    [ -<strong>b</strong> <var>windowsize</var> ]
46    [ -<strong>c</strong> <var>concurrency</var> ]
47    [ -<strong>C</strong> <var>cookie-name</var>=<var>value</var> ]
48    [ -<strong>d</strong> ]
49    [ -<strong>e</strong> <var>csv-file</var> ]
50    [ -<strong>f</strong> <var>protocol</var> ]
51    [ -<strong>g</strong> <var>gnuplot-file</var> ]
52    [ -<strong>h</strong> ]
53    [ -<strong>H</strong> <var>custom-header</var> ]
54    [ -<strong>i</strong> ]
55    [ -<strong>k</strong> ]
56    [ -<strong>n</strong> <var>requests</var> ]
57    [ -<strong>p</strong> <var>POST-file</var> ]
58    [ -<strong>P</strong> <var>proxy-auth-username</var>:<var>password</var> ]
59    [ -<strong>q</strong> ]
60    [ -<strong>r</strong> ]
61    [ -<strong>s</strong> ]
62    [ -<strong>S</strong> ]
63    [ -<strong>t</strong> <var>timelimit</var> ]
64    [ -<strong>T</strong> <var>content-type</var> ]
65    [ -<strong>u</strong> <var>PUT-file</var> ]
66    [ -<strong>v</strong> <var>verbosity</var>]
67    [ -<strong>V</strong> ]
68    [ -<strong>w</strong> ]
69    [ -<strong>x</strong> <var>&lt;table&gt;-attributes</var> ]
70    [ -<strong>X</strong> <var>proxy</var>[:<var>port</var>] ]
71    [ -<strong>y</strong> <var>&lt;tr&gt;-attributes</var> ]
72    [ -<strong>z</strong> <var>&lt;td&gt;-attributes</var> ]
73    [ -<strong>Z</strong> <var>ciphersuite</var> ]
74    [http[s]://]<var>hostname</var>[:<var>port</var>]/<var>path</var></code></p>
75</div><div class="top"><a href="#page-header"><img alt="top" src="/images/up.gif" /></a></div>
76<div class="section">
77<h2><a name="options" id="options">Options</a></h2>
78    <dl>
79    <dt><code>-A <var>auth-username</var>:<var>password</var></code></dt>
80    <dd>Supply BASIC Authentication credentials to the server. The username and
81    password are separated by a single <code>:</code> and sent on the wire
82    base64 encoded. The string is sent regardless of whether the server needs
83    it (<em>i.e.</em>, has sent an 401  authentication needed).</dd>
84
85    <dt><code>-b <var>windowsize</var></code></dt>
86    <dd>Size of TCP send/receive buffer, in bytes.</dd>
87
88    <dt><code>-c <var>concurrency</var></code></dt>
89    <dd>Number of multiple requests to perform at a time. Default is one
90    request at a time.</dd>
91
92    <dt><code>-C <var>cookie-name</var>=<var>value</var></code></dt>
93    <dd>Add a <code>Cookie:</code> line to the request. The  argument  is
94    typically in the form of a <code><var>name</var>=<var>value</var></code>
95    pair. This field is repeatable.</dd>
96
97    <dt><code>-d</code></dt>
98    <dd>Do not display the "percentage served within XX [ms] table". (legacy
99    support).</dd>
100
101    <dt><code>-e <var>csv-file</var></code></dt>
102    <dd>Write a Comma separated value (CSV) file which contains for each
103    percentage (from 1% to 100%) the time (in milliseconds) it took to serve
104    that percentage of the requests. This is usually more useful than the
105    'gnuplot' file; as the results are already 'binned'.</dd>
106
107    <dt><code>-f <var>protocol</var></code></dt>
108    <dd>Specify SSL/TLS protocol (SSL2, SSL3, TLS1, or ALL).</dd>
109
110    <dt><code>-g <var>gnuplot-file</var></code></dt>
111    <dd>Write all measured values out as a 'gnuplot' or TSV (Tab separate
112    values) file. This file can easily be imported into packages like Gnuplot,
113    IDL, Mathematica, Igor or even Excel. The labels are on the first line of
114    the file. </dd>
115
116    <dt><code>-h</code></dt>
117    <dd>Display usage information.</dd>
118
119    <dt><code>-H <var>custom-header</var></code></dt>
120    <dd>Append extra headers to the request.  The  argument  is typically in
121    the form of a valid header line, containing a colon-separated field-value
122    pair (<em>i.e.</em>, <code>"Accept-Encoding: zip/zop;8bit"</code>).</dd>
123
124    <dt><code>-i</code></dt>
125    <dd>Do <code>HEAD</code> requests instead of <code>GET</code>.</dd>
126
127    <dt><code>-k</code></dt>
128    <dd>Enable the HTTP KeepAlive feature, <em>i.e.</em>, perform multiple
129    requests within one HTTP session. Default is no KeepAlive.</dd>
130
131    <dt><code>-n <var>requests</var></code></dt>
132    <dd>Number of requests to perform for the benchmarking session. The default
133    is to just perform a single request which usually leads to
134    non-representative benchmarking results.</dd>
135
136    <dt><code>-p <var>POST-file</var></code></dt>
137    <dd>File containing data to POST.  Remember to also set <code>-T</code>.</dd>
138
139    <dt><code>-P <var>proxy-auth-username</var>:<var>password</var></code></dt>
140    <dd>Supply BASIC Authentication credentials to a proxy en-route. The
141    username and password are separated by a single <code>:</code> and sent on
142    the  wire base64 encoded. The string is sent regardless of whether the
143    proxy needs it (<em>i.e.</em>, has  sent an 407 proxy authentication
144    needed).</dd>
145
146    <dt><code>-q</code></dt>
147    <dd>When processing more than 150 requests, <code>ab</code> outputs a
148    progress count on <code>stderr</code> every 10% or 100 requests or so. The
149    <code>-q</code> flag will suppress these messages.</dd>
150
151    <dt><code>-r</code></dt>
152    <dd>Don't exit on socket receive errors.</dd>
153
154   <dt><code>-s</code></dt>
155    <dd>When compiled in (<code>ab -h</code> will show you) use the SSL
156    protected <code>https</code> rather than the <code>http</code> protocol.
157    This feature is experimental and <em>very</em> rudimentary. You probably
158    do not want to use it.</dd>
159
160    <dt><code>-S</code></dt>
161    <dd>Do not display the median and standard deviation values, nor display
162    the warning/error messages when the average and median are more than
163    one or two times the standard deviation apart. And default to the
164    min/avg/max values. (legacy support).</dd>
165
166    <dt><code>-t <var>timelimit</var></code></dt>
167    <dd>Maximum number of seconds to  spend  for  benchmarking. This implies a
168    <code>-n 50000</code> internally. Use this to benchmark the server within a
169    fixed total amount of time. Per default there is no timelimit.</dd>
170
171    <dt><code>-T <var>content-type</var></code></dt>
172    <dd>Content-type header to use for POST/PUT data, eg.
173    <code>application/x-www-form-urlencoded</code>.
174    Default: <code>text/plain</code>.</dd>
175
176    <dt><code>-u <var>PUT-file</var></code></dt>
177    <dd>File containing data to PUT.  Remember to also set <code>-T</code>.</dd>
178
179    <dt><code>-v <var>verbosity</var></code></dt>
180    <dd>Set verbosity level - <code>4</code> and above prints information on
181    headers, <code>3</code> and above prints response codes (404, 200, etc.),
182    <code>2</code> and above prints warnings and info.</dd>
183
184    <dt><code>-V</code></dt>
185    <dd>Display version number and exit.</dd>
186
187    <dt><code>-w</code></dt>
188    <dd>Print out results in HTML tables. Default table is two columns wide,
189    with a white background.</dd>
190
191    <dt><code>-x <var>&lt;table&gt;-attributes</var></code></dt>
192    <dd>String to use as attributes for <code>&lt;table&gt;</code>. Attributes
193    are inserted <code>&lt;table <var>here</var> &gt;</code>.</dd>
194
195    <dt><code>-X <var>proxy</var>[:<var>port</var>]</code></dt>
196    <dd>Use a proxy server for the requests.</dd>
197
198    <dt><code>-y <var>&lt;tr&gt;-attributes</var></code></dt>
199    <dd>String to use as attributes for <code>&lt;tr&gt;</code>.</dd>
200
201    <dt><code>-z <var>&lt;td&gt;-attributes</var></code></dt>
202    <dd>String to use as attributes for <code>&lt;td&gt;</code>.</dd>
203
204    <dt><code>-Z <var>ciphersuite</var></code></dt>
205    <dd>Specify SSL/TLS cipher suite (See openssl ciphers).</dd>
206    </dl>
207</div><div class="top"><a href="#page-header"><img alt="top" src="/images/up.gif" /></a></div>
208<div class="section">
209<h2><a name="output" id="output">Description of output</a></h2>
210    <p>The following list describes the values returned by <code>ab</code>:
211    </p>
212
213    <dl>
214        <dt>Server Software</dt>
215        <dd>The value, if any, returned in the <var>server</var> HTTP header
216        of the first successful response. This includes all characters in the
217        header from beginning to the point a character with decimal value of 32
218        (most notably: a space or CR/LF) is detected.</dd>
219
220        <dt>Server Hostname</dt>
221        <dd>The DNS or IP address given on the command line</dd>
222
223        <dt>Server Port</dt>
224        <dd>The port to which ab is connecting. If no port is given on the
225        command line, this will default to 80 for http and 443 for
226        https.</dd>
227
228        <dt>SSL/TLS Protocol</dt>
229        <dd>The protocol parameters negotiated between the client and server.
230        This will only be printed if SSL is used.</dd>
231
232        <dt>Document Path</dt>
233        <dd>The request URI parsed from the command line string.</dd>
234
235        <dt>Document Length</dt>
236        <dd>This is size in bytes of the first succesfully returning document.
237        If the document length changes during testing, the response is
238        considered an error.</dd>
239
240        <dt>Concurrency Level</dt>
241        <dd>The number of concurrent clients used during the test</dd>
242
243        <dt>Time taken for tests</dt>
244        <dd>This is the time taken from the moment the first socket connection
245        is created to the moment the last response is recieved</dd>
246
247        <dt>Complete requests</dt>
248        <dd>The number of successful responses recieved</dd>
249
250        <dt>Failed requests</dt>
251        <dd>The number of requests that were considered a failure. If the
252        number is greater than zero, another line will be printed showing the
253        numer of requests that failed due to connecting, reading, incorrect
254        content length, or exceptions.</dd>
255
256        <dt>Write errors</dt>
257        <dd>The number of errors that failed during write (broken pipe).</dd>
258
259        <dt>Non-2xx responses</dt>
260        <dd>The number of responses that were not in the 200 series of response
261        codes. If all responses were 200, this field is not printed.</dd>
262
263        <dt>Keep-Alive requests</dt>
264        <dd>The number of connections that resulted in Keep-Alive requests</dd>
265
266        <dt>Total body sent</dt>
267        <dd>If configured to send data as part of the test, this is the total
268        number of bytes sent during the tests. This field is omitted if the test
269        did not include a body to send.</dd>
270
271        <dt>Total transferred</dt>
272        <dd>The total number of bytes received from the server. This number
273        is essentially the number of bytes sent over the wire.</dd>
274
275        <dt>HTML transferred</dt>
276        <dd>The total number of document bytes received from the server. This
277        number excludes bytes received in HTTP headers</dd>
278
279        <dt>Requests per second</dt>
280        <dd>This is the number of requests per second. This value is the result
281        of dividing the number of requests by the total time taken</dd>
282
283        <dt>Time per request</dt>
284        <dd>The average time spent per request. The first value is calculated
285        with the formula <code>concurrency * timetaken * 1000 / done</code>
286        while the second value is calculated with the formula
287        <code>timetaken * 1000 / done</code></dd>
288
289        <dt>Transfer rate</dt>
290        <dd>The rate of transfer as calculated by the formula
291        <code>totalread / 1024 / timetaken</code></dd>
292    </dl>
293</div><div class="top"><a href="#page-header"><img alt="top" src="/images/up.gif" /></a></div>
294<div class="section">
295<h2><a name="bugs" id="bugs">Bugs</a></h2>
296    <p>There are various statically declared buffers of fixed length. Combined
297    with the lazy parsing of the command line arguments, the response headers
298    from the server and other external inputs, this might bite you.</p>
299
300    <p>It does not implement HTTP/1.x fully; only accepts some 'expected' forms
301    of responses. The rather heavy use of <code>strstr(3)</code> shows up top
302    in profile, which might indicate a performance problem; <em>i.e.</em>, you
303    would measure the <code>ab</code> performance rather than the server's.</p>
304</div></div>
305<div class="bottomlang">
306<p><span>Available Languages: </span><a href="/en/programs/ab.html" title="English">&nbsp;en&nbsp;</a> |
307<a href="/ko/programs/ab.html" hreflang="ko" rel="alternate" title="Korean">&nbsp;ko&nbsp;</a> |
308<a href="/tr/programs/ab.html" hreflang="tr" rel="alternate" title="T�rk�e">&nbsp;tr&nbsp;</a></p>
309</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&amp;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>
310<script type="text/javascript"><!--//--><![CDATA[//><!--
311var comments_shortname = 'httpd';
312var comments_identifier = 'http://httpd.apache.org/docs/2.2/programs/ab.html';
313(function(w, d) {
314    if (w.location.hostname.toLowerCase() == "httpd.apache.org") {
315        d.write('<div id="comments_thread"><\/div>');
316        var s = d.createElement('script');
317        s.type = 'text/javascript';
318        s.async = true;
319        s.src = 'https://comments.apache.org/show_comments.lua?site=' + comments_shortname + '&page=' + comments_identifier;
320        (d.getElementsByTagName('head')[0] || d.getElementsByTagName('body')[0]).appendChild(s);
321    }
322    else { 
323        d.write('<div id="comments_thread">Comments are disabled for this page at the moment.<\/div>');
324    }
325})(window, document);
326//--><!]]></script></div><div id="footer">
327<p class="apache">Copyright 2013 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>
328<p class="menu"><a href="/mod/">Modules</a> | <a href="/mod/directives.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[//><!--
329if (typeof(prettyPrint) !== 'undefined') {
330    prettyPrint();
331}
332//--><!]]></script>
333</body></html>