| Memory problems using cache [message #80739] |
Fri, 26 June 2009 14:51  |
coolvik Messages: 2 Registered: June 2009 |
Junior Member |
|
|
Hi!
I've some Symfony sites running on the same server.
They are all quite simple applications with quite little traffic.
One of the sites runs into problems with the cache once in a while. In the apache log i get errors like:
PHP Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 27852901 bytes) in /var/www/ABC123.se/cache/frontend/prod/config/config_core_compile.yml.php on line 3366
and
PHP Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 26898894 bytes) in /var/www/ABC123.se/cache/frontend/prod/config/config_core_compile.yml.php on line 3366, referer: http://www.ABC123.se/books/search/sortBy/10/page/13
When this happens, all I need to do is to clear the cache for the site and it all works again.
I would appreciate some tips on what to look for in finding the cause.
I'm running version 1.2.7.
|
|
|
|
| Re: Memory problems using cache [message #82112 is a reply to message #81732 ] |
Sun, 19 July 2009 07:11   |
ganchiku Messages: 4 Registered: October 2008 Location: Japan |
Junior Member |
|
|
Hi,
I think I found the solution of this problem.
This is related with routing cache performance.
In line 3366,
$this->cache->set('symfony.routing.data', serialize($this->cacheData));
The problem here is that $this->cacheData is too large, and this takes too much memory to serialize it.
I was investigating this problem, and I think the following thread is related with this problem.
http://forum.symfony-project.org/index.php/m/76842/
Problem they had in the above thread is symfony1.2.4, and I think symfony1.2.7 has the same problem.
But, you don't have to follow their solution, because the one of the symfony1.2.7 features is performance enhancement with routing cache.
http://www.symfony-project.org/blog/2009/05/02/symfony-1-2-7 -more-power
I followed the lazy_cahce_key way, and I don't get the problem error line anymore. Yeah!
Hope this information helps!
|
|
|
|
| Re: Memory problems using cache [message #88219 is a reply to message #88217 ] |
Thu, 12 November 2009 00:52   |
ganchiku Messages: 4 Registered: October 2008 Location: Japan |
Junior Member |
|
|
Hi, caponica,
It was a big trouble for me before, but now it is solved.
The answer is do not use routing cache, and lazy_cache_key is not the best solution either. I forgot to mention it here.
Now, in symfony1.2.9, routing cache is off by default.
http://www.symfony-project.org/blog/2009/09/27/symfony-1-2-9 -is-ready-to-use
And to set routing cache off in symfony1.2.7, set as follows in your factories.yml
all:
routing:
class: sfPatternRouting
param:
cache:
class: sfNoCache
Hope it helps.
[Updated on: Thu, 12 November 2009 00:53]
|
|
|
|
| Re: Memory problems using cache [message #88244 is a reply to message #80739 ] |
Thu, 12 November 2009 12:29  |
caponica Messages: 69 Registered: March 2008 Location: London |
Member |
|
|
Thanks ganchiku,
that change has apparently solved our problem!
C
|
|
|