Tuesday 29 October 2019

Apache benchmark: Specify concurrent requests


-c option used to specify the number of multiple requests to perform at a time. If you do not specify this option, default is one request at a time.

Example

Above statement tells apache benchmark to run 500 requests using 100 concurrent clients.
$ab -n 5000 -c 100 http://localhost:9191/api/v1/cached/employees
This is ApacheBench, Version 2.3 <$Revision: 1826891 $>
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Licensed to The Apache Software Foundation, http://www.apache.org/

Benchmarking localhost (be patient)
Completed 500 requests

Completed 1000 requests
Completed 1500 requests
Completed 2000 requests
Completed 2500 requests
Completed 3000 requests
Completed 3500 requests
Completed 4000 requests
Completed 4500 requests
Completed 5000 requests
Finished 5000 requests


Server Software:        
Server Hostname:        localhost
Server Port:            9191

Document Path:          /api/v1/cached/employees
Document Length:        265 bytes

Concurrency Level:      100
Time taken for tests:   4.018 seconds
Complete requests:      5000
Failed requests:        0
Total transferred:      1920000 bytes
HTML transferred:       1325000 bytes
Requests per second:    1244.29 [#/sec] (mean)
Time per request:       80.367 [ms] (mean)
Time per request:       0.804 [ms] (mean, across all concurrent requests)
Transfer rate:          466.61 [Kbytes/sec] received

Connection Times (ms)
              min  mean[+/-sd] median   max
Connect:        0   38  29.6     37     231
Processing:     1   41  26.5     37     231
Waiting:        1   37  26.4     36     230
Total:          6   79  43.3     78     268

Percentage of the requests served within a certain time (ms)
  50%     78
  66%     88
  75%     96
  80%     99
  90%    107
  95%    188
  98%    255
  99%    259
 100%    268 (longest request)


Let’s run the same on non-cached service.
$ab -n 5000 -c 100 http://localhost:9191/api/v1/employees
This is ApacheBench, Version 2.3 <$Revision: 1826891 $>
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Licensed to The Apache Software Foundation, http://www.apache.org/

Benchmarking localhost (be patient)
Completed 500 requests
Completed 1000 requests
Completed 1500 requests
Completed 2000 requests
Completed 2500 requests
Completed 3000 requests
Completed 3500 requests
Completed 4000 requests
Completed 4500 requests
Completed 5000 requests
Finished 5000 requests


Server Software:        
Server Hostname:        localhost
Server Port:            9191

Document Path:          /api/v1/employees
Document Length:        265 bytes

Concurrency Level:      100
Time taken for tests:   53.613 seconds
Complete requests:      5000
Failed requests:        0
Total transferred:      1920000 bytes
HTML transferred:       1325000 bytes
Requests per second:    93.26 [#/sec] (mean)
Time per request:       1072.255 [ms] (mean)
Time per request:       10.723 [ms] (mean, across all concurrent requests)
Transfer rate:          34.97 [Kbytes/sec] received

Connection Times (ms)
              min  mean[+/-sd] median   max
Connect:        0   17  16.0     12      91
Processing:  1001 1026  22.3   1019    1166
Waiting:     1000 1017  15.3   1013    1092
Total:       1001 1043  31.6   1039    1218

Percentage of the requests served within a certain time (ms)
  50%   1039
  66%   1047
  75%   1055
  80%   1061
  90%   1078
  95%   1109
  98%   1140
  99%   1151
 100%   1218 (longest request)

Explanation of output
First couple of lines specify the version of APache Bench that we used to load test the application.

Server Software: Name of the web server
Server Hostname: Name or IP address of the application that we used for load test.
Server Port: Port of the application.
Document Path: URI parsed
Document Length: It is the size in bytes of the first successfully returned document.
Concurrency Level: Number of concurrent clients used for testing. Since I don't specify any concurrent clients here, test is done with 1 client.
Time taken for tests: Total time taken to perform tests.
Complete requests: Successfully completed requests.
Failed requests: Failed requests
Total transferred: Total number of bytes sent from server.
HTML transferred:  Total number of document bytes received from the server (excludes bytes received in HTTP headers).
Requests per second: Requests processed per second
Time per request: Average time take per request.
Transfer rate: Kilo bytes per second read.
Connection Times (ms): Gives information about connection, waiting and processing time.

Percentage of the requests served within a certain time



Previous                                                    Next                                                    Home

No comments:

Post a Comment