This forum is in READ-ONLY mode.
You can look around, but if you want to ask a new question, please use the new forum.
Home » legacy support » symfony 1.2 » Memory problems using cache
Memory problems using cache [message #80739] Fri, 26 June 2009 14:51 Go to next message
coolvik  is currently offline 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 #81732 is a reply to message #80739 ] Mon, 13 July 2009 05:54 Go to previous messageGo to next message
ganchiku  is currently offline ganchiku
Messages: 4
Registered: October 2008
Location: Japan
Junior Member
Hi, I'm also having the exactly same problem.
I put my php.ini memory_limit as 64M, but it seems still not enough.
Are there any memory leak possibilities?

Well, if anyone find out how to solve this problem, please post here how.

Thanks,
Re: Memory problems using cache [message #82112 is a reply to message #81732 ] Sun, 19 July 2009 07:11 Go to previous messageGo to next message
ganchiku  is currently offline 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. Smile

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! Laughing Laughing Laughing

Hope this information helps!
Re: Memory problems using cache [message #88217 is a reply to message #82112 ] Wed, 11 November 2009 23:47 Go to previous messageGo to next message
caponica  is currently offline caponica
Messages: 69
Registered: March 2008
Location: London
Member
Hi,

I've tried various things mentioned in this thread and elsewhere but still get this out of memory problem.

My apache error log has entries like the following, every few minutes::

[Wed Nov 11 22:36:54 2009] [error] [client 12.34.56.78] PHP Fatal error:  Allowed memory size of 67108864 bytes exhausted (tried to allocate 13905667 bytes) in /home/myproject/cache/frontend/prod/config/config_core_compile.yml.php on line 3365


We are running symfony-1.2.7 and, in settings.yml we have the following in /myproject/apps/frontend/config/settings.yml:

all:
  .settings:
    lazy_cache_key:         on


I thought this was meant to prevent the problem? Or is there something else that I need to do as well? The documentation (blog posts) on the subject are not entirely clear.

Thanks in advance to anyone who can help on this!


C
Re: Memory problems using cache [message #88219 is a reply to message #88217 ] Thu, 12 November 2009 00:52 Go to previous messageGo to next message
ganchiku  is currently offline 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 #88233 is a reply to message #88219 ] Thu, 12 November 2009 09:55 Go to previous messageGo to next message
caponica  is currently offline caponica
Messages: 69
Registered: March 2008
Location: London
Member
Thanks for the quick reply - I'll try it out and let you know if it solves the problem!
Re: Memory problems using cache [message #88244 is a reply to message #80739 ] Thu, 12 November 2009 12:29 Go to previous message
caponica  is currently offline caponica
Messages: 69
Registered: March 2008
Location: London
Member
Thanks ganchiku,

that change has apparently solved our problem!

C
Previous Topic:sfPropelPager error in join
Next Topic:Last-Modified header
Goto Forum:
  

powered by FUDforum - copyright ©2001-2004 FUD Forum Bulletin Board Software