Loading

How to benchmark an HTTP/HTTPS service using AB (Apache Benchmark) command line tool

Publiseringsdato: Mar 2, 2024
Oppgave

GOAL

AB (Apache Benchmark) command line tool is usually installed by default in most Linux and UNIX systems (can be installed on Windows as well). It is a featured and simple command line tool to perform a load test against an HTTP/HTTPS API.

The complete documentation can be found in the following link: https://httpd.apache.org/docs/2.4/programs/ab.html

Trinn

For example, to send 10000 GET requests to a target HTTP service, with 50 concurrent clients, and setting the custom request header "UUID" to "my-uuid":

ab -n 10000 -c 50 -H "UUID: my-uuid" http://localhost:8081/v1/clients

The command displays the progress on the console and when it completes, it will show the detailed results of the benchmark:

Server Software:        
Server Hostname:        127.0.0.1
Server Port:            8081

Document Path:          /v1/clients
Document Length:        8 bytes

Concurrency Level:      50
Time taken for tests:   4.827 seconds
Complete requests:      10000
Failed requests:        0
Total transferred:      1000000 bytes
HTML transferred:       80000 bytes
Requests per second:    2071.79 [#/sec] (mean)
Time per request:       24.134 [ms] (mean)
Time per request:       0.483 [ms] (mean, across all concurrent requests)
Transfer rate:          202.32 [Kbytes/sec] received

Connection Times (ms)
              min  mean[+/-sd] median   max
Connect:        0    9   6.9      8     104
Processing:     3   15  15.9     13     221
Waiting:        0   12  15.6     10     221
Total:          6   24  16.6     21     222

Percentage of the requests served within a certain time (ms)
  50%     21
  66%     24
  75%     26
  80%     27
  90%     29
  95%     34
  98%     60
  99%     97
 100%    222 (longest request)
Knowledge-artikkelnummer

001115044

 
Laster
Salesforce Help | Article