First off the cache is there to reduce memory consumption as when your cache
is clear symfony will need to rebuild all the cache files and so that first
run after a cleared cache is very high.

One way to reduce your memory footprint is in the Propel criteria you use
and the data returned. Propel's hydration of returned data into objects can
be quite high. We have actually used the Propel method doSelectRS
(doSelectStmt in Propel 1.3) and selectively chosen which fields the query
should return as well as then iterating through the result set ourselves and
adding them to an array instead of having fully hydrated objects which can
be memory hogs.

For small queries where the number of results returned is always going to be
small, doSelect as is is great, but for large, unwieldy datasets its a
better idea to use doSelectRS/doSelectStmt and then manage the results
yourself.

Another tip, always use retriveByPk and doSelectOne whenever you can as that
is the same as running a query with "LIMIT 1" set and is also far more
memory efficient than doing a fully hydrated doSelect().

On Sat, Sep 26, 2009 at 11:05 AM, Inspiran <inspi...@gmail.com> wrote:

>
> Hi,
>
> I am already struggling for some time with my symfony application.
> After clearing the cache my application consumes between 50 and 60
> MB.  Without a clear cache the average consumption is between 15 and
> 30 MB.  I find this a rather high number.  I am using symfony 1.2.8 ,
> propel ORM and around 50 routes (no propel collections, just propel
> routes).  I have 50 object / tables.
>
> I have installed and looked at the trace generated by xdebug and
> notice that even before any action is really loaded, it already
> consumes up to 20MB.  The things I tried to already lower the memory
> foot print:
>
> - Removed comments from the Object and Peer classes
> - Created my own Peer and ObjectBuilder which removes dozens of
> methods which i don't use (such as joinExcept...,
> docount...except, ...).
> - Cleaned up all my routes (i removed the propelRouteCollections)
> - Tried to use 'sfNoCache' for the routing class.
>
> Still I am not reallying seeing a way how to lower the memory
> footprint.  Could somebody help me to understand what my next steps
> should be?
>
> I have created two traces (one just after clearing the cache and next
> one after refreshing the page) which can be found here
> http://inspiran.be/traces.zip
>
>
> Thank you very much!
>
> >
>


-- 
Gareth McCumskey
http://garethmccumskey.blogspot.com
twitter: @garethmcc

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"symfony users" group.
To post to this group, send email to symfony-users@googlegroups.com
To unsubscribe from this group, send email to 
symfony-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/symfony-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to