Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why is sylius running so slow on local in dev?

Tags:

symfony

sylius

I followed sylius' install instructions for composer and got my local copy working. The issue is when I go to local/app_dev.php it takes an extremely long time to load, 12-18 seconds. however the profiler is showing a much faster time...

Also the installation instructions don't explain how to get local/app.php working or a production environment. Any information would be helpful :).

like image 205
Kirill Fuchs Avatar asked Jul 04 '13 12:07

Kirill Fuchs


2 Answers

First let me thank @Florian for his link and the nudge to get me digging a little :).

When following the instructions on sylius' getting started page:

$ wget http://getcomposer.org/composer.phar
$ composer.phar create-project sylius/sylius -s dev
$ cd sylius
$ app/console sylius:install

you are by default installing using the config_dev.yml file. This will setup your db as {dbname}_dev, as well as have debug on in app_dev.php. When debug is on "cache files are dynamically rebuilt on each request." This is what is causing the slow speed.

In regards to using app.php(production env) you can run app/console sylius:install -e prod. This will setup a regular db and you can use app.php.

Mystery solved :).

Useful resource: How to Master and Create new Environments - Symfony2

like image 135
Kirill Fuchs Avatar answered Sep 27 '22 20:09

Kirill Fuchs


If you are on windows make sure to set your "realpath_cache_size" to at least 5M in your php.ini, as recommended by the SensioDistributionBundle. Like so:

; php.ini

realpath_cache_size = 5M

On my Sylius installation running in dev environment it reduced load times from ~15 s to ~2 s.

To further reduce your load times you might consider using WinCache https://sourceforge.net/projects/wincache/. I use the following settings while running Sylius with PHP's inbuilt web server:

; php.ini

[wincache]

wincache.enablecli=1

wincache.filecount=16384

WinCache seems to work just fine with Sylius's dev environment.

like image 34
Oggy Avatar answered Sep 27 '22 21:09

Oggy