]> granicus.if.org Git - apache/blob - docs/manual/programs/ab.xml
xforms
[apache] / docs / manual / programs / ab.xml
1 <?xml version='1.0' encoding='UTF-8' ?>
2 <!DOCTYPE manualpage SYSTEM "../style/manualpage.dtd">
3 <?xml-stylesheet type="text/xsl" href="../style/manual.en.xsl"?>
4 <!-- $LastChangedRevision$ -->
5
6 <!--
7  Licensed to the Apache Software Foundation (ASF) under one or more
8  contributor license agreements.  See the NOTICE file distributed with
9  this work for additional information regarding copyright ownership.
10  The ASF licenses this file to You under the Apache License, Version 2.0
11  (the "License"); you may not use this file except in compliance with
12  the License.  You may obtain a copy of the License at
13
14      http://www.apache.org/licenses/LICENSE-2.0
15
16  Unless required by applicable law or agreed to in writing, software
17  distributed under the License is distributed on an "AS IS" BASIS,
18  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
19  See the License for the specific language governing permissions and
20  limitations under the License.
21 -->
22
23 <manualpage metafile="ab.xml.meta">
24 <parentdocument href="./">Programs</parentdocument>
25
26 <title>ab - Apache HTTP server benchmarking tool</title>
27
28 <summary>
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 </summary>
35 <seealso><program>httpd</program></seealso>
36
37 <section id="synopsis"><title>Synopsis</title>
38     <p><code><strong>ab</strong>
39     [ -<strong>A</strong> <var>auth-username</var>:<var>password</var> ]
40     [ -<strong>b</strong> <var>windowsize</var> ]
41     [ -<strong>B</strong> <var>local-address</var> ]
42     [ -<strong>c</strong> <var>concurrency</var> ]
43     [ -<strong>C</strong> <var>cookie-name</var>=<var>value</var> ]
44     [ -<strong>d</strong> ]
45     [ -<strong>e</strong> <var>csv-file</var> ]
46     [ -<strong>f</strong> <var>protocol</var> ]
47     [ -<strong>g</strong> <var>gnuplot-file</var> ]
48     [ -<strong>h</strong> ]
49     [ -<strong>H</strong> <var>custom-header</var> ]
50     [ -<strong>i</strong> ]
51     [ -<strong>k</strong> ]
52     [ -<strong>n</strong> <var>requests</var> ]
53     [ -<strong>p</strong> <var>POST-file</var> ]
54     [ -<strong>P</strong> <var>proxy-auth-username</var>:<var>password</var> ]
55     [ -<strong>q</strong> ]
56     [ -<strong>r</strong> ]
57     [ -<strong>s</strong> ]
58     [ -<strong>S</strong> ]
59     [ -<strong>t</strong> <var>timelimit</var> ]
60     [ -<strong>T</strong> <var>content-type</var> ]
61     [ -<strong>u</strong> <var>PUT-file</var> ]
62     [ -<strong>v</strong> <var>verbosity</var>]
63     [ -<strong>V</strong> ]
64     [ -<strong>w</strong> ]
65     [ -<strong>x</strong> <var>&lt;table&gt;-attributes</var> ]
66     [ -<strong>X</strong> <var>proxy</var>[:<var>port</var>] ]
67     [ -<strong>y</strong> <var>&lt;tr&gt;-attributes</var> ]
68     [ -<strong>z</strong> <var>&lt;td&gt;-attributes</var> ]
69     [ -<strong>Z</strong> <var>ciphersuite</var> ]
70     [http[s]://]<var>hostname</var>[:<var>port</var>]/<var>path</var></code></p>
71 </section>
72
73 <section id="options"><title>Options</title>
74     <dl>
75     <dt><code>-A <var>auth-username</var>:<var>password</var></code></dt>
76     <dd>Supply BASIC Authentication credentials to the server. The username and
77     password are separated by a single <code>:</code> and sent on the wire
78     base64 encoded. The string is sent regardless of whether the server needs
79     it (<em>i.e.</em>, has sent an 401  authentication needed).</dd>
80
81     <dt><code>-b <var>windowsize</var></code></dt>
82     <dd>Size of TCP send/receive buffer, in bytes.</dd>
83
84     <dt><code>-B <var>local-address</var></code></dt>
85     <dd>Address to bind to when making outgoing connections.</dd>
86
87     <dt><code>-c <var>concurrency</var></code></dt>
88     <dd>Number of multiple requests to perform at a time. Default is one
89     request at a time.</dd>
90
91     <dt><code>-C <var>cookie-name</var>=<var>value</var></code></dt>
92     <dd>Add a <code>Cookie:</code> line to the request. The  argument  is
93     typically in the form of a <code><var>name</var>=<var>value</var></code>
94     pair. This field is repeatable.</dd>
95
96     <dt><code>-d</code></dt>
97     <dd>Do not display the "percentage served within XX [ms] table". (legacy
98     support).</dd>
99
100     <dt><code>-e <var>csv-file</var></code></dt>
101     <dd>Write a Comma separated value (CSV) file which contains for each
102     percentage (from 1% to 100%) the time (in milliseconds) it took to serve
103     that percentage of the requests. This is usually more useful than the
104     'gnuplot' file; as the results are already 'binned'.</dd>
105
106     <dt><code>-f <var>protocol</var></code></dt>
107     <dd>Specify SSL/TLS protocol (SSL2, SSL3, TLS1, or ALL).</dd>
108
109     <dt><code>-g <var>gnuplot-file</var></code></dt>
110     <dd>Write all measured values out as a 'gnuplot' or TSV (Tab separate
111     values) file. This file can easily be imported into packages like Gnuplot,
112     IDL, Mathematica, Igor or even Excel. The labels are on the first line of
113     the file. </dd>
114
115     <dt><code>-h</code></dt>
116     <dd>Display usage information.</dd>
117
118     <dt><code>-H <var>custom-header</var></code></dt>
119     <dd>Append extra headers to the request.  The  argument  is typically in
120     the form of a valid header line, containing a colon-separated field-value
121     pair (<em>i.e.</em>, <code>"Accept-Encoding: zip/zop;8bit"</code>).</dd>
122
123     <dt><code>-i</code></dt>
124     <dd>Do <code>HEAD</code> requests instead of <code>GET</code>.</dd>
125
126     <dt><code>-k</code></dt>
127     <dd>Enable the HTTP KeepAlive feature, <em>i.e.</em>, perform multiple
128     requests within one HTTP session. Default is no KeepAlive.</dd>
129
130     <dt><code>-n <var>requests</var></code></dt>
131     <dd>Number of requests to perform for the benchmarking session. The default
132     is to just perform a single request which usually leads to
133     non-representative benchmarking results.</dd>
134
135     <dt><code>-p <var>POST-file</var></code></dt>
136     <dd>File containing data to POST.  Remember to also set <code>-T</code>.</dd>
137
138     <dt><code>-P <var>proxy-auth-username</var>:<var>password</var></code></dt>
139     <dd>Supply BASIC Authentication credentials to a proxy en-route. The
140     username and password are separated by a single <code>:</code> and sent on
141     the  wire base64 encoded. The string is sent regardless of whether the
142     proxy needs it (<em>i.e.</em>, has  sent an 407 proxy authentication
143     needed).</dd>
144
145     <dt><code>-q</code></dt>
146     <dd>When processing more than 150 requests, <code>ab</code> outputs a
147     progress count on <code>stderr</code> every 10% or 100 requests or so. The
148     <code>-q</code> flag will suppress these messages.</dd>
149
150     <dt><code>-r</code></dt>
151     <dd>Don't exit on socket receive errors.</dd>
152
153    <dt><code>-s</code></dt>
154     <dd>When compiled in (<code>ab -h</code> will show you) use the SSL
155     protected <code>https</code> rather than the <code>http</code> protocol.
156     This feature is experimental and <em>very</em> rudimentary. You probably
157     do not want to use it.</dd>
158
159     <dt><code>-S</code></dt>
160     <dd>Do not display the median and standard deviation values, nor display
161     the warning/error messages when the average and median are more than
162     one or two times the standard deviation apart. And default to the
163     min/avg/max values. (legacy support).</dd>
164
165     <dt><code>-t <var>timelimit</var></code></dt>
166     <dd>Maximum number of seconds to  spend  for  benchmarking. This implies a
167     <code>-n 50000</code> internally. Use this to benchmark the server within a
168     fixed total amount of time. Per default there is no timelimit.</dd>
169
170     <dt><code>-T <var>content-type</var></code></dt>
171     <dd>Content-type header to use for POST/PUT data, eg.
172     <code>application/x-www-form-urlencoded</code>.
173     Default: <code>text/plain</code>.</dd>
174
175     <dt><code>-u <var>PUT-file</var></code></dt>
176     <dd>File containing data to PUT.  Remember to also set <code>-T</code>.</dd>
177
178     <dt><code>-v <var>verbosity</var></code></dt>
179     <dd>Set verbosity level - <code>4</code> and above prints information on
180     headers, <code>3</code> and above prints response codes (404, 200, etc.),
181     <code>2</code> and above prints warnings and info.</dd>
182
183     <dt><code>-V</code></dt>
184     <dd>Display version number and exit.</dd>
185
186     <dt><code>-w</code></dt>
187     <dd>Print out results in HTML tables. Default table is two columns wide,
188     with a white background.</dd>
189
190     <dt><code>-x <var>&lt;table&gt;-attributes</var></code></dt>
191     <dd>String to use as attributes for <code>&lt;table&gt;</code>. Attributes
192     are inserted <code>&lt;table <var>here</var> &gt;</code>.</dd>
193
194     <dt><code>-X <var>proxy</var>[:<var>port</var>]</code></dt>
195     <dd>Use a proxy server for the requests.</dd>
196
197     <dt><code>-y <var>&lt;tr&gt;-attributes</var></code></dt>
198     <dd>String to use as attributes for <code>&lt;tr&gt;</code>.</dd>
199
200     <dt><code>-z <var>&lt;td&gt;-attributes</var></code></dt>
201     <dd>String to use as attributes for <code>&lt;td&gt;</code>.</dd>
202
203     <dt><code>-Z <var>ciphersuite</var></code></dt>
204     <dd>Specify SSL/TLS cipher suite (See openssl ciphers)</dd>
205     </dl>
206 </section>
207
208 <section id="output"><title>Output</title>
209     <p>The following list describes the values returned by <code>ab</code>:
210     </p>
211
212     <dl>
213         <dt>Server Software</dt>
214         <dd>The value, if any, returned in the <var>server</var> HTTP header
215         of the first successful response. This includes all characters in the
216         header from beginning to the point a character with decimal value of 32
217         (most notably: a space or CR/LF) is detected.</dd>
218
219         <dt>Server Hostname</dt>
220         <dd>The DNS or IP address given on the command line</dd>
221
222         <dt>Server Port</dt>
223         <dd>The port to which ab is connecting. If no port is given on the
224         command line, this will default to 80 for http and 443 for
225         https.</dd>
226
227         <dt>SSL/TLS Protocol</dt>
228         <dd>The protocol parameters negotiated between the client and server.
229         This will only be printed if SSL is used.</dd>
230
231         <dt>Document Path</dt>
232         <dd>The request URI parsed from the command line string.</dd>
233
234         <dt>Document Length</dt>
235         <dd>This is the size in bytes of the first successfully returned document.
236         If the document length changes during testing, the response is
237         considered an error.</dd>
238
239         <dt>Concurrency Level</dt>
240         <dd>The number of concurrent clients used during the test</dd>
241
242         <dt>Time taken for tests</dt>
243         <dd>This is the time taken from the moment the first socket connection
244         is created to the moment the last response is received</dd>
245
246         <dt>Complete requests</dt>
247         <dd>The number of successful responses received</dd>
248
249         <dt>Failed requests</dt>
250         <dd>The number of requests that were considered a failure. If the
251         number is greater than zero, another line will be printed showing the
252         number of requests that failed due to connecting, reading, incorrect
253         content length, or exceptions.</dd>
254
255         <dt>Write errors</dt>
256         <dd>The number of errors that failed during write (broken pipe).</dd>
257
258         <dt>Non-2xx responses</dt>
259         <dd>The number of responses that were not in the 200 series of response
260         codes. If all responses were 200, this field is not printed.</dd>
261
262         <dt>Keep-Alive requests</dt>
263         <dd>The number of connections that resulted in Keep-Alive requests</dd>
264
265         <dt>Total body sent</dt>
266         <dd>If configured to send data as part of the test, this is the total
267         number of bytes sent during the tests. This field is omitted if the test
268         did not include a body to send.</dd>
269
270         <dt>Total transferred</dt>
271         <dd>The total number of bytes received from the server. This number
272         is essentially the number of bytes sent over the wire.</dd>
273
274         <dt>HTML transferred</dt>
275         <dd>The total number of document bytes received from the server. This
276         number excludes bytes received in HTTP headers</dd>
277
278         <dt>Requests per second</dt>
279         <dd>This is the number of requests per second. This value is the result
280         of dividing the number of requests by the total time taken</dd>
281
282         <dt>Time per request</dt>
283         <dd>The average time spent per request. The first value is calculated
284         with the formula <code>concurrency * timetaken * 1000 / done</code>
285         while the second value is calculated with the formula
286         <code>timetaken * 1000 / done</code></dd>
287
288         <dt>Transfer rate</dt>
289         <dd>The rate of transfer as calculated by the formula
290         <code>totalread / 1024 / timetaken</code></dd>
291     </dl>
292 </section>
293
294 <section id="bugs"><title>Bugs</title>
295     <p>There are various statically declared buffers of fixed length. Combined
296     with the lazy parsing of the command line arguments, the response headers
297     from the server and other external inputs, this might bite you.</p>
298
299     <p>It does not implement HTTP/1.x fully; only accepts some 'expected' forms
300     of responses. The rather heavy use of <code>strstr(3)</code> shows up top
301     in profile, which might indicate a performance problem; <em>i.e.</em>, you
302     would measure the <code>ab</code> performance rather than the server's.</p>
303 </section>
304
305
306 </manualpage>