Is Taylor Otwell Right About Fabien’s Statement on Symfony’s Benchmark?
Symfony has recently released two versions, 3.4 and 4.0, that are very different from the standard release of the framework. I have already discussed the new structure and Symfony Flex in my previous articles.
These two releases are hot topic these days because of the debate around the comparison of the performance of these versions with Laravel 5.5 (the latest version of the Laravel framework). Top level people from both sides (including even Fabien and Taylor Otwell) have expressed their opinion on the issue.
Please read the complete article. It’s all started with Fabien’s article on Symfony 4 titled “Performance out of the Box”, in which he presented the following comparison of the performance of the two framework:
Laravel community had different ideas about the performance of the two frameworks. In response to the Fabien’s article, Taylor Otwell produced the results of the performance benchmarking tests.
Having read both opinions and getting confused about the issue, I decided to benchmark Symfony 3.4, 4 and Laravel 5.5 on a DigitalOcean 2GB server managed by Cloudways PHP hosting. I decided to use a higher number of request and concurrent users on the same Apache Benchmark tool, that comes pre-configured and installed on all Cloudways managed servers.
First, here is a list of services that are active on the server:
Varnish caching is off and PHP-FPM is running along with Redis and Memcached. I decided to use the default versions of both the frameworks
Let’s Do The Test
Taylor Otwell used Apache Benchmarks for his round of tests. I decided to use the tool but with much higher level of stress in the form of increased number of requests and concurrent users. The following were the parameters of the test:
Total Number of Requests: 500
Concurrent Users: 50
Symfony 3.4 : 500 Requests & 50 Concurrent Users
Symfony 4 : 500 Requests & 50 Concurrent Users
Laravel 5.5: 500 Requests & 50 Concurrent Users
I decided to increase the stress on the server!
I decided to send 1000 Requests with 100 Concurrent Users. Here are the results:
Symfony 3.4 : 1000 Requests & 100 Concurrent Users
Symfony 4 : 1000 Requests & 100 Concurrent Users
Laravel 5.5: 1000 Requests & 100 Concurrent Users
You could get the full picture of the test from the above screenshots. Following are the highlights of the experiment that might surprise you:
As you could clearly see, Laravel takes almost double the time in ms as compared to Symfony. Another huge issue is that Symfony 4 is failing so many requests on 1000 requests with 100 concurrent users. I think Symfony team should take a note of this and try to replicate the results to judge the accuracy of the results. Surprisingly, Symfony 3.4 performed well in the test.
As Taylor said that this is not a fair benchmarks because symfony has cut down a lots of dependencies in latest release. The concept of one composer.json file and Symfony flex. So I decided to compare the standard release of symfony 3.3 with laravel 5.5 and here are the results.
Surprises! On 500 Requests with 50 concurrent users Laravel performs good (36.174 ms) but will 11 failed request. Time/Request of laravel is also less then Symfony 3.3.
On 1000 requests and 100 concurrent users Laravel serves more requests/sec (26.04 mean) then symfony 3.3 (21.41 mean). Also the time/request is less which is 3839.835 ms while Symfony 3.3 got 4670.972 ms. Again, So many requests are failing by symfony 200/1000.
So With my honest opinion Laravel works well while comparing Symfony standard release and Laravel 5.5.
P.S.: don’t hesitate to follow me on Twitter, and/or here on Medium. ;-) Thanks for reading.