Answer the question
In order to leave comments, you need to log in
Is Symfony slow?
I'm currently learning Symfony 3 on PHP 7 and wondering about performance.
There is a task of writing a Rest API, I decided to try Symfony 3, wrote a test API and tried to execute the Apache AB test (ab -t 10 -c 10) for a non- existent method, the processing speed is 2062 requests in 10 seconds or 206 requests per second.
I do the same on Phalcon, the speed is 23297 requests per 10 seconds or 2329.69 requests per second. If you run one request, then the speed is the same, about 90 ms.
What's the catch? Maybe I'm doing something wrong and somewhere I need to configure something so that a non-existent request has a higher speed or is it a normal speed? It is clear that Symfony has a high abstraction and therefore performance is less, but here you just need to print a 404 error.
The Phalcon gap becomes smaller if you take and add a search operation to the database and mapping, through the model built into the framework. Phalcon is still faster though, 1600 requests versus Symfony's 900 requests in 10 seconds.
Configuration: PHP 7, Debian, opcache on, Symfony3, Phalcon 3, Symfony cache enabled, Production mode.
Connected bundles in Symfony:
new Symfony\Bundle\FrameworkBundle\FrameworkBundle(),
new Symfony\Bundle\SecurityBundle\SecurityBundle(),
new Symfony\Bundle\TwigBundle\TwigBundle(),
new Symfony\Bundle\MonologBundle\MonologBundle(),
new Symfony\Bundle\SwiftmailerBundle \SwiftmailerBundle(),
new Doctrine\Bundle\DoctrineBundle\DoctrineBundle(),
new Sensio\Bundle\FrameworkExtraBundle\SensioFrameworkExtraBundle(),
new AppBundle\AppBundle(),
new FOS\RestBundle\FOSRestBundle(),
new JMS\SerializerBundle\JMSSerializerBundle( ),
new Nelmio\CorsBundle\NelmioCorsBundle()
20383 www-data 20 0 380884 26040 18020 R 58.3 0.3 0 : 10.35 php- fpm7.0 -data 20 0 380884 25908 17900 R 57.3 0.3 0:02.77 php-fpm7.0 19479 www -data 20 0 380884 26044 18020 R 52.0 0.3 0:09.30 php-fpm7.0
24110 www-data 20 0 379016 17876 12848 S 13.6 0.2 0:03.57 php - fpm7.0 -data 20 0 378884 17608 12788 S 13.3 0.2 0:01.08 php-fpm7.0 25445 www-data 20 0 378884 17780 12848 S 13.0 0.2 0:02.48 php-fpm7.0 27177 www-data 20 0 378884 17600 12788 R 13.0 0.2 0:00.91 php-fpm7.0
Answer the question
In order to leave comments, you need to log in
1. When testing a non-existent method in symfony, an exception is thrown, and this is always expensive and slow.
2. When the existing method was tested, the difference showed the real performance of the framework. And the difference in a little less than 2 times is not so big.
3. Symfony is not used for performance gains. Much more important here is the speed of development and the quality of the code.
Your test is about nothing, you need to test a real application, moreover, in a production environment.
And there is no point in testing them: symfony is for the most serious projects that can be done in PHP, and phalcon is rather just a proof of concept that the framework can be a PHP module, I don’t see a single case when it would be the best solution. Because if you need high performance for a microservice, then there are solutions that are much more productive, of an asynchronous type.
Also, as a confirmation to the answer 27cm :
https://sitecoder.blogspot.ru/2015/07/high-perform...
From experience I can say that in the future, in real large projects, with a bunch of events, bundles, etc., symphony turns out to be terribly slow. On my project now, my Action is just starting to execute, and 500ms of time has already passed. This is after all attempts to speed up, cache, etc.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question