[ZODB-Dev] [Enhancement Proposal] Memory size limited Cache

Dieter Maurer dieter at handshake.de
Thu Oct 5 13:57:46 EDT 2006


Chris Withers wrote at 2006-10-5 10:32 +0100:
> ...
>I like the idea of an interface allowing alternate cache 
>implementations, but will it suffer from not knowing what other possible 
>implementations could need or is this a really well defined boundary anyway?

There are two boundaries:

  towards persistent -- this is the C-API specified in the proposal
  (the cache on the other hand uses all implementation details
  of "persistent" that are useful).

  towards higher ZODB levels and/or the application:
  you have the methods available now and "updateSizeEstimation"
  and any methods a specific cache implementation whats
  to provide (e.g. for statistics with respect to cache
  efficiency).

> ...
>Is there a performance hit for using the pickle size?

The pickle size is a *VERY* rough estimation (probably wrong
by a factor of 5 to 15) but at the places where I want to use
it, it is very cheap to get at (the connection has
determined the pickle because it has just read it from storage
or written it into the storage).

We probably would get a much better estimation using
"PySizer" but probably at a significantly higher cost.

>I guess I'm asking 
>if we have to pick the object to find it's pickle size?

Only the connection puts an object into the cache (at least when the
cache is used regularly). When it does, it knows the pickle size
(see above).



-- 
Dieter


More information about the ZODB-Dev mailing list