3

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?

Andrei Serdeliuc ॐ
  • 5,828
  • 5
  • 39
  • 66
  • It looks like [table metadata caching](http://framework.zend.com/manual/en/zend.db.table.html#zend.db.table.metadata.caching) uses any instance of [Zend_Cache_Core](http://framework.zend.com/manual/en/zend.cache.frontends.html#zend.cache.frontends.core). There are [lots of backends](http://framework.zend.com/manual/en/zend.cache.backends.html) available. Do they perform any better, memory-wise? – Charles Jul 26 '10 at 07:52

1 Answers1

0

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
  • 7,973
  • 6
  • 45
  • 74