Reputation: 11690
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
.
Upvotes: 3
Views: 1661
Reputation: 4129
Try to set HTTP version to 1.0 for Slim App:
$app = new \Slim\App(['settings' => ['httpVersion'=>'1.0']]);
It seems like ab test has a bug for the PHP header code:
<?php
header("HTTP/1.1 200 OK");
exit;
Upvotes: 0
Reputation: 29955
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.
Upvotes: 1