We're looking for a PHP framework to work with in future and are currently testing out things with Symfony 2. For this, we've redesigned our API and implemented it as a bundle in Symfony. It turned out that Symfony seems to be very slow - actually far slower than our old (not even well-designed) system.
We tried to optimise the performance by caching the byte code (using APC for this). While we've noticed a huge improvement in performance (before: about 3 seconds to load the API; after: 0.6 seconds in average (still 0.5 seconds slower than our old system without APC)), we're kind of excited - but still not really pleased with the high loading time of such an easy task like getting one result out of an almost empty database.
I don't know, but I could imagine this is due to Symfony autoloading all classes, even when not needed for a specific bundle.
Now, before we deep-six Symfony, we'd like to look out for further optimisations, possibly a way to exclude unneeded components in a specific bundle, as I personally think this would make a big difference.
I'd be thankful for any ideas on how to further improve the performance, experience reports with using Symfony or anything else that could be helpful for us on the lookout for a framework.
Edit:
Some information about the testing environment:
Also, all tests are done on a local copy of our system, so possible network issues can be excluded.
These points can optimise your application performance:
Upgrade PHP. The performance gain between PHP 5.3 and PHP 5.4 is very high. PHP 5.5 would be even better, but it's not supported by all distributions, like Debian 7.
NGINX is faster than Apache and the configuration is easier.
Using PHP-FPM with NGINX is a good combination. You can also run your PHP with HHVM which is in average 2x faster than PHP-FPM, provided you replace Symfony/Assetic with Grunt. Caution: HHVM requires more precaution and testing before deploying safely. You can follow these two articles (in French): JoliCode and Big Brains Company
PHP APC extension is deprecated. I think that XCache, Memcached or Redis are better, and they're also most supported at the moment. For PHP >= 5.5, APCu can be used as a replacement for APC.
Additionally, you can read a few articles which talk about Symfony2 optimisation and provide Twig benchmarks.
PHP articles:
Symfony2 and Twig articles:
Others optimisations:
Did you look this blog post ? http://symfony.com/blog/push-it-to-the-limits-symfony2-for-high-performance-needs
According to your information, i can advise you to try php 5.5 or 5.6 and NGINX with PHP-FPM, it can 40% faster or more.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With