Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>I had 5-30 sec responses from Symfony2 by default. <strong>Now it's ~500ms</strong> in dev environment.</p> <p>Then I modified the following things in <code>php.ini</code>:</p> <ul> <li><strong>set <code>realpath_cache_size = 4M</code></strong> (or more)</li> <li>disabled <code>XDebug</code> completely (test with <code>phpinfo</code>)</li> <li>realpath_cache_ttl=7200</li> <li>enabled and set <code>OPcache</code> (or APC) correctly</li> <li>restarted Apache in order to have php.ini reloaded</li> </ul> <p>And voilá, responses went under 2 secs in dev mode! Hope it helps.</p> <p><strong>Before:</strong> 6779 ms <img src="https://i.stack.imgur.com/aJePm.png" alt="enter image description here"></p> <p><strong>After:</strong> 1587 ms</p> <p><img src="https://i.stack.imgur.com/OpDDm.png" alt="enter image description here"></p> <p>Symfony2 reads classes from thousands of files and that's a slow process. When using a small PHP realpath cache, file paths need to be resolved one by one every time a new request is made in the dev environment if they are not in PHP's realpath cache. The realpath cache is too small by default for Symfony2. In prod this is not a problem of course.</p> <h2>Cache metadata:</h2> <p>Caching the metadata (e.g. mappings) is also very important for further performance boost:</p> <pre><code>doctrine: orm: entity_managers: default: metadata_cache_driver: apc query_cache_driver: apc result_cache_driver: apc </code></pre> <p>You need to enable <code>APCu</code> for this. It's <code>APC</code> without bytecode cache, as <code>OPCache</code> already does opcode caching. <code>OPCache</code> is built in since PHP 5.5.</p> <h2>---- <strong>After:</strong> 467 ms ----</h2> <p>(in prod environment the same response is ~80 ms)</p> <p><a href="https://i.stack.imgur.com/yyMbm.png" rel="noreferrer"><img src="https://i.stack.imgur.com/yyMbm.png" alt="enter image description here"></a></p> <p>Please note, this is project uses 30+ bundles and has tens of thousands of lines of code, almost hundred own services, so 0.5s is quite good on a local Windows environment using just a few simple optimizations.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload