ab flags & options
-n
Number of requests to perform.
ab -n 1000 http://localhost:8080/
-c
Number of concurrent requests.
ab -n 1000 -c 50 http://localhost:8080/
-t
Maximum number of seconds to spend benchmarking.
ab -t 30 -c 10 http://localhost:8080/
-H
Add a custom header to the request.
ab -n 100 -H "Authorization: Bearer token123" http://localhost:8080/api
-p
File containing data to POST.
ab -n 100 -p data.json -T application/json http://localhost:8080/api
-T
Content-Type header for POST data.
ab -n 100 -p payload.xml -T text/xml http://localhost:8080/api
-k
Enable HTTP KeepAlive (persistent connections).
ab -n 1000 -c 50 -k http://localhost:8080/
-s
Set timeout in seconds. Default is 30.
ab -n 100 -s 10 http://localhost:8080/
-v
Set verbosity level (1–4). Higher shows more headers/body info.
ab -n 1 -v 3 http://localhost:8080/
-e
Write a CSV file with response time percentiles.
ab -n 1000 -c 50 -e results.csv http://localhost:8080/