I am working on a new project to work and got confused by a strange problem when my application takes a long time to return the answer in both dev and prod. However, sometimes it returns a response very quickly. I read a few posts here about possible reasons why none of them solved my problems.
At first I thought it was because I had several sub requests, so I deleted them, but still had the same problems.
My average query is only 20-30 MB in DEV. I am trying to use a profiler to help me figure out where this might come from, however, each request shows that the longest part of the request will be a different area. For example, in one request the controller was the longest section, in another request on the same page it was a template listener, and the other was a security / firewall listener.
For example, a quick request on my home page takes about 116 ms. I am waiting for a min, updating and taking 9467 ms, or even saw that it takes 30,000 + ms.
While I can live with a little slowness in dev mode, prod does the same. Sometimes fast, sometimes slow. APC cache is enabled. Usually my doctrine requests take 4-20 ms to complete depending on the page.
I ran PHP 5.3, but decided to upgrade to 5.4 to see if this helped, but the same problems. I am using the latest stable build of nginx. PHP in FPM. The server works with other websites without problems - both with magento web applications and symfony 1.4 without any problems.
The server is a quad-core quad-core processor with 32 GB of RAM, so I have a lot of resources. Watching processes, when I make requests, I do not see abnormal CPU or memory loads.
I still need to try to run the application on another machine, but I donβt understand why all my other applications will work fine, and this is the only one who is experiencing such slowness. I will probably experience this tonight, but I wanted to see if anyone could experience such a problem before.
Here are some snapshots from my profiler when the request takes a long time:




Here are two when the request was fast as expected


This is my composer .json
{ "name": "spliced/commerce", "minimum-stability": "dev", "description": "", "autoload": { "psr-0": { "": "src/" } }, "require": { "php": ">=5.3.3", "symfony/symfony": "2.2.*", "doctrine/orm": "2.4.*", "doctrine/doctrine-bundle": "1.2.*", "twig/extensions": "1.0.*@dev", "symfony/swiftmailer-bundle": "2.2.*", "symfony/monolog-bundle": "2.2.*", "sensio/distribution-bundle": "2.2.*", "sensio/framework-extra-bundle": "2.2.*", "sensio/generator-bundle": "2.2.*", "jms/security-extra-bundle": "1.4.*", "jms/di-extra-bundle": "1.3.*", "symfony/assetic-bundle": "2.1.*", "kriswallsmith/assetic": "1.1.*@dev", "vbardales/multiple-app-kernel-bundle": "dev-master", "avalanche123/imagine-bundle": "v2.1", "knplabs/knp-menu-bundle" : "dev-master", "knplabs/knp-paginator-bundle": "dev-master", "knplabs/knp-components": "*", "symfony-cmf/routing-extra-bundle": "*", "stof/doctrine-extensions-bundle" : "dev-master", "facebook/php-sdk": "3.2.*", "kertz/twitteroauth" : "*", "adoy/oauth2" : "dev-master", "guzzle/guzzle" : "dev-master", "knplabs/knp-snappy-bundle": "dev-master", "symfony-cmf/routing-extra-bundle" : "*", "floriansemm/solr-bundle": "dev-master" }, "require-dev": { "zendframework/zendframework": "dev-master", "elao/web-profiler-extra-bundle" : "dev-master" }, "repositories": { "goutte": { "type": "package", "package": { "name": "fabpot/goutte", "version": "dev-master", "source": { "type": "git", "url": "git://github.com/fabpot/Goutte.git", "reference": "master" }, "autoload": { "psr-0": { "Goutte": "src/" } } } } }, "scripts": { "post-install-cmd": [ "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::buildBootstrap", "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::clearCache", "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installAssets", "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installRequirementsFile" ], "post-update-cmd": [ "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::buildBootstrap", "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::clearCache", "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installAssets", "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installRequirementsFile" ] }, "config": { "bin-dir": "bin" }, "extra": { "symfony-app-dir": "commons", "symfony-web-dir": "web", "branch-alias": { "dev-master": "2.2-dev" } } }