1
votes

I am benchmarking php application with apache benchmark. I have the server on my local machine. I run the following:

ab -n 100 -c 10 http://my-domain.local/

And get this:

Connection Times (ms)
              min  mean[+/-sd] median   max
Connect:        0    3   3.7      2       8
Processing:   311  734 276.1    756    1333
Waiting:      310  722 273.6    750    1330
Total:        311  737 278.9    764    1341

However, if I refresh my browser on the page http://my-domain.local/ I find out it takes a lot longer than 737 ms (the mean that ab reports) to load the page (around 3000-4000 ms). I can repeat this many times and the loading of the page in the browser always takes at least 3000 ms.

I tested another, heavier page (page load in browser takes 8-10 seconds). I used a concurrency of 1 to simulate one user loading the page:

ab -n 100 -c 1 http://my-domain.local/heavy-page/

And the results are here:

Connection Times (ms)
              min  mean[+/-sd] median   max
Connect:        0    0   0.1      0       1
Processing:    17   20   4.7     18      46
Waiting:       16   20   4.6     18      46
Total:         17   20   4.7     18      46

So what does the total line on the ab results actually tell? Clearly it's not the number of milliseconds the browser is loading the web page. Is the number of milliseconds that it takes from browser to load the page (X) linearly dependent of number of the total mean milliseconds ab reports (Y)? So if I'm able to reduce half of Y, have I also reduced half of X?

(Also Im not really sure what Processing, Waiting and Total mean).


I'll reopen this question since I'm facing the problem again. Recently I installed Varnish. I run ab like this: ab -n 100 http://my-domain.local/ Apache bench reports very fast response times:

Requests per second:    462.92 [#/sec] (mean)
Time per request:       2.160 [ms] (mean)
Time per request:       2.160 [ms] (mean, across all concurrent requests)
Transfer rate:          6131.37 [Kbytes/sec] received

Connection Times (ms)
              min  mean[+/-sd] median   max
Connect:        0    0   0.0      0       0
Processing:     1    2   2.3      1      13
Waiting:        0    1   2.0      1      12
Total:          1    2   2.3      1      13

So the time per request is about 2.2 ms. When I browse the site (as an anonymous user) the page load time is about 1.5 seconds.

Here is a picture from Firebug net tab. As you can see my browser is waiting 1.68 seconds for my site to response. Why is this number so much bigger than the request times ab reports? Snapshot from Firebug net tab

2

2 Answers

0
votes

Are you running ab on the server? Don't forget that your browser is local to you, on a remote network link. An ab run on the webserver itself will have almost zero network overhead and report basically the time it takes for Apache to serve up the page. Your home browser link will have however many milliseconds of network transit time added in, on top of the basic page-serving overhead.

0
votes

Ok.. I think I know what's the problem. While I have been measuring the page load time in browser I have been logged in.. So none of the heavy stuff is happening. The page load times in browser with anonymous user are closer to the ones ab is reporting.