ApacheBench is useful when one endpoint needs a quick, repeatable pressure test before and after a web server, application, cache, or network change. A controlled run shows whether the endpoint completed the requested work, how many requests failed, and how throughput and latency moved at a chosen concurrency level.
The ab command sends the same request until it reaches a request count with -n or a time limit with -t. Its report includes Complete requests, Failed requests, Requests per second, two Time per request lines, transfer rate, and percentile timing so matching runs can be compared without changing the URL, headers, body, or client path.
Because ab benchmarks one URL at a time and does not fully model browser traffic, HTTP/2, HTTP/3, or every HTTP/1.x response shape, treat it as a focused endpoint check rather than a full load-testing platform. Start with low concurrency, include an explicit path such as
http://www.example.net/
, and run high-load tests only on systems where the owner has approved the traffic.
Related: How to authenticate with a bearer token in cURL
Related: How to send custom headers with wget
Related: How to test Apache configuration
ab rejects URLs that stop at the host name.
$ ab -n 1 -c 1 http://www.example.net ab: invalid URL Usage: ab [options] [http[s]://]hostname[:port]/path ##### snipped #####
$ ab -n 20 -c 2 http://www.example.net/ ##### snipped ##### Document Path: / Concurrency Level: 2 Complete requests: 20 Failed requests: 0 Requests per second: 5270.09 [#/sec] (mean) Time per request: 0.380 [ms] (mean)
If the baseline shows failures, redirects, authentication errors, or a different document path than expected, fix that condition before increasing concurrency.
$ ab -n 1000 -c 10 http://www.example.net/ This is ApacheBench, Version 2.3 <$Revision: 1923142 $> ##### snipped ##### Server Software: Apache/2.4.66 Server Hostname: www.example.net Server Port: 80 Document Path: / Document Length: 10672 bytes Concurrency Level: 10 Time taken for tests: 0.070 seconds Complete requests: 1000 Failed requests: 0 Requests per second: 14224.55 [#/sec] (mean) Time per request: 0.703 [ms] (mean) Time per request: 0.070 [ms] (mean, across all concurrent requests) Transfer rate: 152052.65 [Kbytes/sec] received
On Debian and Ubuntu systems, /usr/bin/ab is installed by the apache2-utils package.
Requests per second is throughput for the completed run. The first Time per request line is the average latency seen by each concurrent client. The second Time per request line divides total test time across all completed requests.
$ ab -n 10000 -c 50 http://www.example.net/
Large concurrency values can overwhelm the target, saturate the benchmark client, or trigger rate limits. Keep production tests coordinated and reversible.
$ ab -n 1000 -c 10 -k http://www.example.net/ ##### snipped ##### Concurrency Level: 10 Complete requests: 1000 Failed requests: 0 Keep-Alive requests: 997 Requests per second: 25001.88 [#/sec] (mean) Time per request: 0.400 [ms] (mean)
Compare runs with and without -k only when the application normally receives both connection patterns or when connection setup cost is the question being tested.
$ ab -t 30 -c 20 -k http://www.example.net/
-t sets the maximum benchmark duration and internally implies a large request count, so the timer ends the run.
$ ab -n 2000 -c 20 -l http://www.example.net/dashboard/
Without -l, changing response length is reported as a failed length check even when every request returned an acceptable status.
$ ab -n 1000 -c 20 -H 'Host: www.example.net' -H 'Authorization: Bearer REDACTED' http://203.0.113.50/
Repeat -H for additional headers, use -C name=value for cookies, and use -A user:pass only for endpoints that require HTTP Basic authentication.
{"message":"hello"}
$ ab -n 500 -c 10 -p payload.json -T 'application/json' http://api.example.net/submit
Benchmarking write operations can create, update, or duplicate data. Use an idempotent test endpoint or a disposable environment.
$ ab -n 5000 -c 50 -k -e percentiles.csv -g times.tsv http://www.example.net/
-e writes percentile data as CSV, while -g writes tab-separated timing data that can be imported into plotting or spreadsheet tools.
$ ab -n 5000 -c 50 -k http://www.example.net/ > ab-5000-50-k.txt
Keep the URL, headers, body, concurrency, client host, and network path the same when comparing one report against another.
ab -h
when additional flags such as -s, -q, or -r are needed.