Question

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 :).

Was it helpful?

Solution

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

OTHER TIPS

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.

I was running Sylius on a Vagrant setup with default sync folder settings and found it extremely slow, up to 45 sec loads! Other Small Symfony projects weren't as bad so thought it was just Sylius, then I read that the synched folder settings on Vagrant are a lot quicker with the type NFS available on linux systems, it reduced from 40 to 4 seconds!

So if you're using Vagrant and find it slow make sure you set sync folders to NFS.

Sylius much slower then Symfony both in production and development mode although it is built on top of Symfony. The reason is its ResourceBundle. I'm sure there are methods to accelerate it in production but anyway it is very slow while development.

NFS will help you in vagrant case but still you can find it slow in bigger projects. Docker was even worse on MACOSX. If you are using Linux I think docker will kick ass for developemnt. Also if you are using PHP<7 move to 7.0 (upper versions have some issues with Sylius atm) and you will see huge improvement of performance even in dev enviroment.

Also give some more RAM to your Vagrant machine

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top