Pavel Dubinin
Pavel Dubinin

Reputation: 2430

Symfony2 - very slow bootstrap on shared hosting

There's a big issue I am facing with now - symfony takes 7-10sec to bootstrap. Some research showed that this is because of tons of file inclusions symfony makes at start.

On my local machine I could fix it by increasing realpath_cache_size setting at php.ini, but on shared hosting this does not work (because open_basedir restriction is in effect and php disables realpath cache in this situation).

Now I am stuck as obviosly application is not usable with such huge bootstrap delay. Does anyone have this issue.. how can I fix it?

Upvotes: 3

Views: 1611

Answers (1)

Martin Richard
Martin Richard

Reputation: 1639

There are a lot of ways do fasten symfony bootstrap.

A few hints:

  • Be sure you use the "prod" environment (and production settings: debugging and profiling disabled, cache enabled, less verbose logs),
  • Under high QPS, don't use default PHP sessions handler, it uses a file lock on the user's session file, which disallow parralelized queries (it can hurt a lot if you use Ajax a lot),
  • Using the filesystem can be quite slow for caching (especially on shared hosting): put the cache directories under a tmpfs mountpoint or override the caching backend in order to use something else than the filesystem (see http://nerdpress.org/2012/07/10/caching-data-in-symfony2).

See the following checklist covering the basics of symfony2 application deployement for production: http://www.symfony2-checklist.com/

Upvotes: 3

Related Questions