开发者

Zend_Cache unserialize - memory hog?

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.l开发者_StackOverflowifetime = 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?


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. :)

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜