Sitemap
ÖMER FARUK İÇEN

ÖMER FARUK İÇEN

Java Senior Developer

Apache Bench

1 min readJan 7, 2024

Apache Bench, commonly known as ab, is a command-line tool that comes bundled with the Apache HTTP Server. It is designed for performing benchmarking or load testing on web servers by generating a significant number of requests to measure how well a web server responds under a specified load.

Get ÖMER FARUK İÇEN’s stories in your inbox

Join Medium for free to get updates from this writer.

The basic usage of Apache Bench is as follows:

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

Parameters:

  • -n requests: Specifies the total number of requests to perform during the test.
  • -c concurrency: Sets the number of multiple requests to perform at a time.
  • -t timelimit: Sets a time limit for the test, terminating it after the specified number of seconds.
  • -k: Enables HTTP KeepAlive, allowing multiple requests to be sent over a single persistent connection.
  • -p POST-file: Allows sending POST data from a file.
  • -H headerline: Adds a header to the HTTP request.

HttpMethods Examples:

  1. GET
ab -n 100 -c 10 http://example.com/

2. POST

ab -n 100 -c 10 -p post_data.txt -T application/json http://example.com/

3.DELETE

ab -n 100 -c 10 -X DELETE http://example.com/

4.PUT

ab -n 100 -c 10 -p put_data.txt -T application/json -X PUT http://example.com/resource

--

--