[Dev] two layer object caching
jeremy at alum.mit.edu
Mon Nov 4 13:05:14 PST 2002
>>>>> "DM" == David McCusker <david at treedragon.com> writes:
DM> I usually tell folks a two layer caching scheme is a good idea,
DM> as opposed to just one layer of caching. Below I explain what
DM> this means. It might or might not be applicable to a given
DM> storage system or object persistence system, depending on how
DM> the system works inside. Note this technique is not applicable
DM> to load-everything-in-memory systems.
Is this on topic for this list? (I'm not trying to be snide, just
unclear on what the focus of this list should be.)
ZODB uses an in-memory object cache for performance and to manage
pointer swizzling, i.e. mapping from persistent object references to
Python object references. One limitation of this cache is that its
size is measured in objects instead of bytes. There's no obvious way
to determine the amount of memory a Python object is occupying.
ZODB FileStorage doesn't have the low cache that you mention. It
depends entirely on the OS to handle file caching. ZODB's
client-server storage (ZEO) does have a file-based LRU cache to avoid
reloading objects from the server.
If you have limited memory, it's not clear to me whether it's better
spent on high cache, low cache, or a mixture of both. I expect
application characteristics would be an important effect.
More information about the Dev