42
votes

What is the difference between those 2 fields? :

  • Time per request (mean)
  • Time per request (mean, across all concurrent requests)

How is each of them calculated?

Sample Output:

Time per request:       3953.446 [ms] (mean)
Time per request:       39.534 [ms] (mean, across all concurrent requests)

Why is there much difference?

2

2 Answers

28
votes

Here is an example of an ab's test result. I make 1000 requests that with 3 concurrent requests.

C:\>ab -d -e a.csv -v 1 -n 1000 -c 3 http://www.example.com/index.aspx
This is ApacheBench, Version 2.0.41-dev <$Revision: 1.121.2.12 $> apache-2.0
Copyright (c) 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Copyright (c) 2006 The Apache Software Foundation, http://www.apache.org/

Benchmarking www.m-taoyuan.tw (be patient)
Completed 100 requests
Completed 200 requests
Completed 300 requests
Completed 400 requests
Completed 500 requests
Completed 600 requests
Completed 700 requests
Completed 800 requests
Completed 900 requests
Finished 1000 requests


Server Software:        Microsoft-IIS/6.0
Server Hostname:        www.m-taoyuan.tw
Server Port:            80

Document Path:          /index.aspx
Document Length:        25986 bytes

Concurrency Level:      3
Time taken for tests:   25.734375 seconds
Complete requests:      1000
Failed requests:        0
Write errors:           0
Total transferred:      26372000 bytes
HTML transferred:       25986000 bytes
Requests per second:    38.86 [#/sec] (mean)
Time per request:       77.203 [ms] (mean)
Time per request:       25.734 [ms] (mean, across all concurrent requests)
Transfer rate:          1000.72 [Kbytes/sec] received

Connection Times (ms)
              min  mean[+/-sd] median   max
Connect:        0    1   4.4      0      15
Processing:    62   75   9.1     78     109
Waiting:       46   64   8.0     62     109
Total:         62   76   9.3     78     109

As you can see, there are two Time per request field.

  • Time per request (mean)
  • Time per request (mean, across all concurrent requests)

Please check the Time taken for tests field first. The value is 25.734375 seconds which is 25734.375 ms.

If we divide 25734.375 ms by 1000, you get 25.734 [ms] which is exact the Time per request (mean, across all concurrent requests) field's value.

For the Time per request (mean), the value is 77.203 [ms]. The value is a bit longer than Time per request (mean, across all concurrent requests). That is because the (mean) is counted by every specific request and calculate it's mean time.

Let me give you an simple example.

Assume that we make 3 requests with 3 concurrent connections. The Time taken for tests will be 90ms and each request are 40ms, 50ms, 30ms. So what's the value of these two Time per request?

  • Time per request (mean) = ( 40 + 50 + 30 ) / 3 = 40ms
  • Time per request (mean, across all concurrent requests) = 90 / 3 = 30ms

Hope you can understand. :)

21
votes

It would be helpful to see your input, but, I believe the output is telling you that there is no time savings for performing concurrent requests.

Time per request (mean) tells you the average amount of time it took for a concurrent group of requests to process.

Time per request (mean, across all concurrent requests) tells you the average amount of time it took for a single request to process by itself.

If you processed 100 requests concurrently, it took 3953.446ms.

If you processed them individually, it would take 39.534ms * 100 = 3953.4ms

Same number. There is no time savings to performing concurrent requests (at least for the total number of requests you tested).