views:

51

answers:

1

I've setup Zend_Db_Table_Abstract so it uses metadata cache and then profiled with xhprof to see how much memory it uses.

Turns out 34 calls from _setupMetadata to Zend_Cache_Core::load use up 7mb memory, most of it being used by calling unserialize.

The configuration for the metadata cache is:

resources.cachemanager.db_metadata.frontend.name = Core
resources.cachemanager.db_metadata.frontend.options.automatic_serialization = true
resources.cachemanager.db_metadata.frontend.options.lifetime = null

resources.cachemanager.db_metadata.backend.name = File
resources.cachemanager.db_metadata.backend.options.cache_dir = APPLICATION_PATH "/../data/cache/db_metadata"

Is this a common issue, or am I missing something?

A: 

Since you are serializing object it take a lot of memory. Especially Zend_Db_* object.

Here we had the same issue and we end up in making you own cache system.

What you can do is to define sleep / wakeup so that you remove all unnecessary ivar from Zend_Db_Table_Row_Abstract but you have to make sure to not break class invariant.

Good luck. :)

mathk