Skip to content

Latest commit

 

History

History
102 lines (61 loc) · 2.96 KB

File metadata and controls

102 lines (61 loc) · 2.96 KB

TAGLINE

HTTP server benchmarking tool

TLDR

Benchmark a URL with 100 requests using 10 concurrent connections

ab -n 100 -c 10 [http://example.com/]

POST data to a URL

ab -n 100 -c 10 -p [data.json] -T application/json [http://example.com/api]

Use keep-alive connections

ab -n 100 -c 10 -k [http://example.com/]

Set a custom header

ab -n 100 -c 10 -H "Authorization: Bearer [token]" [http://example.com/]

SYNOPSIS

ab [-n requests] [-c concurrency] [-t timelimit] [options] URL

DESCRIPTION

ab (Apache Benchmark) is a command-line tool for benchmarking HTTP servers. It generates load by sending multiple requests to a specified URL and measures server response times, throughput, and other performance metrics.

The tool reports statistics including requests per second, time per request, transfer rate, and connection times broken down by percentiles. It supports both HTTP and HTTPS, custom headers, POST data, cookies, and HTTP authentication.

PARAMETERS

-n requests

Number of requests to perform for the benchmarking session

-c concurrency

Number of multiple requests to perform at a time (simultaneous connections)

-t timelimit

Maximum number of seconds to spend benchmarking (implies -n 50000)

-k

Enable HTTP KeepAlive feature (persistent connections)

-p file

File containing data to POST

-T content-type

Content-type header for POST/PUT data

-H header

Append extra header to the request (repeatable)

-A auth

HTTP Basic Authentication credentials (user:password)

-C cookie

Add a Cookie header (name=value)

-s timeout

Maximum seconds to wait before socket times out (default 30)

-v verbosity

Verbosity level (2=warnings, 3=response codes, 4+=headers)

-u file

File containing data to PUT (also set -T)

-X proxy[:port]

Use a proxy server for the requests

-e csv-file

Write a CSV file with response time percentiles (1%-100%)

-g gnuplot-file

Write measured values as a gnuplot/TSV file

-i

Use HEAD requests instead of GET

-l

Accept variable document length (for dynamic pages)

-r

Don't exit on socket receive errors

-q

Suppress progress messages on stderr (for >150 requests)

CAVEATS

ab creates synthetic load that may not reflect real-world traffic patterns. It does not parse HTML or execute JavaScript, so it only tests raw HTTP performance. Results can be misleading if the server implements rate limiting or caching. For more realistic load testing, consider tools like wrk, siege, or k6.

HISTORY

ab was created as part of the Apache HTTP Server project in the late 1990s. It was designed as a simple benchmarking tool for testing Apache configurations during development. The tool has remained largely unchanged and is bundled with Apache HTTPD installations worldwide.

SEE ALSO

curl(1), wrk(1), siege(1)