On Tue, May 11, 2010 at 7:37 PM, Ryan Noon <rmn...@gmail.com> wrote:
> Hi Jim,
> I'm really sorry for the miscommunication, I thought I made that clear in my
> last email:
> "I'm wrapping ZODB in a 'ZMap' class that just forwards all the dictionary
> methods to the ZODB root and allows easy interchangeability with my old
> sqlite OODB abstraction."

Perhaps I should have picked up on this, but it wasn't clear that you
were refering to word_id_docset. I couldn't see that in the code and I
didn't get an answer to my question.

> wordid_to_docset is a "ZMap", which just wraps the ZODB
> boilerplate/connection and forwards dictionary methods to the root.

This is the last piece to the puzzle.  The root object is a persistent
mapping object that is a single database object and is thus not a
scalable data structure.  As Lawrence pointed out, this, together with
the fact that you're using non-persistent arrays as mapping values
means that all your data is in a single object.

> but I'm still sorta worried because in my experimentation with ZODB
> so far I've never been able to observe it sticking to any cache limits, no
> matter how often I tell it to garbage collect (even when storing very small
> values that should give it adequate granularity...see my experiment at the
> end of my last email).

The unit of granularity is the persistent object.  It is persitent
object that are managed by the cache, not indivdual Python objects
like strings.  If your entire database is in a single persistent
object, then you're entire database will be in memory.

If you want a scallable mapping and your keys are stabley ordered (as
are strings and numbers) then you should use a BTree.  BTrees spread
there data over multiple data records, so you can have massive
mappings without storing massive amounts of data in memory.

If you want a set and the items are stabley ordered, then a TreeSet
(or a Set if the set is known to be small.)

There are build-in BTrees and sets that support compact storage of
signed 32-bit or 64-bit ints.

Jim

-- 
Jim Fulton
_______________________________________________
For more information about ZODB, see the ZODB Wiki:
http://www.zope.org/Wikis/ZODB/

ZODB-Dev mailing list  -  ZODB-Dev@zope.org
https://mail.zope.org/mailman/listinfo/zodb-dev

Reply via email to