not logged in | [Login]

Apache Bench (ab)

ab is a highly configurable tool for benchmarking requests to servers.

Example POST

# data.json: a file containing the json to POST
# -n: Number of requests
# -c: Concurrency level
# -p: POST the data in data.json. To PUT, use -u
# -T: The content type
# -H: A custom header named 'customer_header' and with a value of 'value1'

ab -n 100 -c 10 -p data.json -T application/json -H "customer_header:value1" "http://localhost:80/v1/someapi"

Example GET

This is a simple GET

ab -n 100 -c 10 "http://localhost:80/v1/someapi"

Example output

Server Software:        
Server Hostname:        localhost
Server Port:            80

Document Path:          /v1/someapi
Document Length:        101 bytes

Concurrency Level:      10
Time taken for tests:   11.194 seconds
Complete requests:      100
Failed requests:        0
Total transferred:      29400 bytes
Total body sent:        50500
HTML transferred:       10100 bytes
Requests per second:    8.93 [#/sec] (mean)
Time per request:       1119.416 [ms] (mean)
Time per request:       111.942 [ms] (mean, across all concurrent requests)
Transfer rate:          2.56 [Kbytes/sec] received
                        4.41 kb/s sent
                        6.97 kb/s total

Connection Times (ms)
              min  mean[+/-sd] median   max
Connect:        0    1   1.1      1       4
Processing:   924 1118 153.4   1150    1370
Waiting:      924 1117 153.1   1149    1370
Total:        926 1119 153.0   1151    1371

Percentage of the requests served within a certain time (ms)
  50%   1151
  66%   1189
  75%   1252
  80%   1322
  90%   1364
  95%   1369
  98%   1370
  99%   1371
 100%   1371 (longest request)