Search code examples
phpbenchmarkingslimapachebenchsilex

ApacheBench is very slow


I have created two benchmark pages using Slim and Silex micro frameworks, then tested them for speed.

Chrome Developer Tools result:

Slim: 7ms

Silex: 16ms

ApacheBench result:

# Slim
$ ab -n 1 -c 1 'http://localhost/webapps/FrameworksBenchmarking/Slim/data/123'
> 5.008 seconds

# Silex
ab -n 1 -c 1 'http://localhost/webapps/FrameworksBenchmarking/Silex/data/123'
> 0.001 seconds

I don't understand what makes ab so slow with Slim. Any ideas on this issue?

PS as you can see, there's no problem requesting page in browser. Also, it's fast with curl.


Solution

  • Do you use PHP Accelerator? Have you warmed up everything before benchmarking? -n 1 -c 1 doesn't seem sufficient to provide any accurate statistics. Try to increase a number of repetitions.