Apache benchmarking (ab) commands cheat sheet

Here is a cli commands cheat sheet for ab command (apache http server bechmarking tool), you can use this as a quick reminder for basic commands with a brief description for each of the commands.

What is ab command?

Apache HTTP server benchmarking tool, ab is a tool for benchmarking your Apache Hypertext Transfer Protocol (HTTP) server. It is designed to give you an impression of how your current Apache installation performs. This especially shows you how many requests per second your Apache installation is capable of serving.

# To send 100 requests with a concurency of 50 requests to a URL:
ab -n 100 -c 50 [url]

# To send requests for 30 seconds with a concurency of 50 requests to a URL:
ab -t 30 -c 50  [url]

# Execute 100 HTTP GET requests, in concurrent batches of 10, to a URL:
ab -n 100 -c 10 [url]

# Execute 100 HTTP POST requests to a URL, using a JSON payload from a file:
ab -n 100 -T application/json -p path/to/file.json url

# Use HTTP [K]eep Alive, i.e. perform multiple requests within one HTTP session:
ab -k [url]

# Set the maximum number of seconds to spend for benchmarking:
ab -t 60 [url]

Check out Ab command doucumentation.

You can also check our MegaSh cheatsheet tool, that has 150+ searchable linux cheat sheets in one page, so you never forget a command as you work again

Check Also

Best AI tools list