Tuesday 29 October 2019

Apache benchmark: Send n requests to the application


Syntax
ab -n {number_of_requests} {url}

Example

$ab -n 50 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).....done


Server Software:        
Server Hostname:        localhost
Server Port:            9191

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

Concurrency Level:      1
Time taken for tests:   0.065 seconds
Complete requests:      50
Failed requests:        0
Total transferred:      19200 bytes
HTML transferred:       13250 bytes
Requests per second:    772.46 [#/sec] (mean)
Time per request:       1.295 [ms] (mean)
Time per request:       1.295 [ms] (mean, across all concurrent requests)
Transfer rate:          289.67 [Kbytes/sec] received

Connection Times (ms)
              min  mean[+/-sd] median   max
Connect:        0    0   0.0      0       0
Processing:     1    1   0.4      1       3
Waiting:        1    1   0.4      1       2
Total:          1    1   0.5      1       3

Percentage of the requests served within a certain time (ms)
  50%      1
  66%      1
  75%      1
  80%      2
  90%      2
  95%      3
  98%      3
  99%      3
 100%      3 (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


Let's run the benchmarking tool on non-cached api 'http://localhost:9191/api/v1/employees'.
ab -n 50 http://localhost:9191/api/v1/employees

$ab -n 50 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).....done


Server Software:        
Server Hostname:        localhost
Server Port:            9191

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

Concurrency Level:      1
Time taken for tests:   50.283 seconds
Complete requests:      50
Failed requests:        0
Total transferred:      19200 bytes
HTML transferred:       13250 bytes
Requests per second:    0.99 [#/sec] (mean)
Time per request:       1005.665 [ms] (mean)
Time per request:       1005.665 [ms] (mean, across all concurrent requests)
Transfer rate:          0.37 [Kbytes/sec] received

Connection Times (ms)
              min  mean[+/-sd] median   max
Connect:        0    0   0.1      0       1
Processing:  1003 1005   1.6   1006    1009
Waiting:     1002 1005   1.5   1005    1007
Total:       1003 1006   1.6   1006    1010

Percentage of the requests served within a certain time (ms)
  50%   1006
  66%   1006
  75%   1007
  80%   1007
  90%   1007
  95%   1008
  98%   1010
  99%   1010
 100%   1010 (longest request)




Previous                                                    Next                                                    Home

No comments:

Post a Comment