EsopMx
EsopMx

Reputation: 85

Symfony first time slow loading

I have been developing a web page named: directorioelectronico.com and I have specially issues now, I will be very grateful that someone can be help me.

The web page is loading very slow in the first loading (5,000ms - 20,000ms) (latest are speeded normally) I tried to install APC module but my host is shared and the administrator can not install it, so I resize realpath_cache_size to 2M and the performance is now better (4,000 - 16,000 ms) somebody knows how I can perform it much more?

In advance, Thank you very much for you help.

Upvotes: 0

Views: 3967

Answers (4)

EsopMx
EsopMx

Reputation: 85

My issue was that my share host haven't APC cache and for symfony2 is mandatory have it for have a good load so I change my host provider and now I have a VPS where I can install APC and now it is very fast.

Upvotes: 1

maschmann
maschmann

Reputation: 311

I'd also suggest to enable query and result caches for doctrine (did you install/active apc cache for your php installation?). This might further reduce the loading time. Just have a look here :-) Also try to use a deployment script to automatically trigger the cache clear/warmup, mentioned above. This way you won't forget to call those. Do you use assetic for css/js? Then combine those files, minify them via assetic filters

Good candidates for deployment scripts are ansible, capifony or just a simple shell script.

Upvotes: 1

piers.warmers
piers.warmers

Reputation: 333

After clear:cache the next call on the application will have to rebuild a number cached files. That can be slow - so why make a site visitor trigger it?

If you're clearing the cache in production, try using the cache:warmup command to pre-build the the cache. It will mean the next visitor won't have to wait while the heavy lifting is done.

Something like this should help:

$ php ./app/console clear:cache --env=prod
$ php ./app/console clear:warmup

More info in the Symfony documentation.

Upvotes: 0

Alister Bulman
Alister Bulman

Reputation: 35169

The first time a Symfony program is run with env=prod, it has to create a significant amount of cached code - parsing the routes, annotations, converting configurations files and preparing CSS and Javascript.

It will always be a lot slower the first time, so that the rest of the time it will be fast. If you can run it before the website goes live (eg, with app/console), then that work can happen offline.

Upvotes: 0

Related Questions