Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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.

like image 807
Roman Newaza Avatar asked Feb 28 '26 02:02

Roman Newaza


1 Answers

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.

like image 177
Vladislav Rastrusny Avatar answered Mar 02 '26 16:03

Vladislav Rastrusny



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!