[ZODB-Dev] experimenting with Standalone ZODB...

enrico.sirola@riskmap.net enrico.sirola@riskmap.net
19 Oct 2001 16:46:45 +0200


>>>>> "Casey" == Casey Duncan <c.duncan@nlada.org> writes:

    Casey> AFAIK: a persistentMapping (like a dict) is a monolithic
    Casey> object. It therefore is loaded all at once (all keys and
    Casey> values) when it is accessed. That is likely using up all of
    Casey> the memory of your machine.

    Casey> You should use a BTree as your products object if you want
    Casey> it to be able to load and unload individual elements from
    Casey> memory.

    Casey> I think on IOBTree (Integer to object mapping) might work
    Casey> in your case.

While digging the list's past threads I saw there was a huge thread on
the caching subject some time ago 
It seems that the problem is related with garbage collection. A call
to <Connection instance>.cacheGC() after every history read seems 
to solve the problem, (I tried it even with ZOE + multithreading client and it
works quite well - the cache reaches 40-45MB and remains around this
value). 
Prolly an explicit call to cacheGC() isn't very
elegant, but it works (I think this implies that one writes a
wrapper class who do this dirty work and reuse this). 

Your advice about BTrees lead me in exploring the amazing world of
Catalogs. I found this document:

http://www.zope.org/Members/kelcmab3/catalog_out_of_zope

which explains how to use them outside ZOPE, but it seems I can't
import ZCatalog from a command line python2.1 interpreter (Zope 2.4.1
here). Here's what's happening:

Python 2.1.1 (#5, Oct 18 2001, 19:54:10)
[GCC 2.95.4 20010902 (Debian prerelease)] on linux2
Type "copyright", "credits" or "license" for more information.
>>> import sys
>>> sys.path.append('/home/sirolae/various_sources/Zope-2.4.1-src/lib/python')
>>> import ZODB
>>> import Persistence
>>> from Persistence import Persistent
>>> from ZODB.FileStorage import FileStorage
>>> from Products.ZCatalog.Catalog import Catalog
Traceback (most recent call last):
  File "<stdin>", line 1, in ?
  File "/home/sirolae/various_sources/Zope-2.4.1-src/lib/python/Products/ZCatalog/__init__.py", line 88, in ?
    import ZCatalog, Catalog, CatalogAwareness,  ZClasses
  File "/home/sirolae/various_sources/Zope-2.4.1-src/lib/python/ZClasses/__init__.py", line 20, in ?
    import ZClass
  File "/home/sirolae/various_sources/Zope-2.4.1-src/lib/python/ZClasses/ZClass.py", line 88, in ?
    import Method, Basic, Property, AccessControl.Role, re
  File "/home/sirolae/various_sources/Zope-2.4.1-src/lib/python/ZClasses/Method.py", line 91, in ?
    import App.Dialogs, ZClasses, App.Factory, App.Product, App.ProductRegistry
  File "/home/sirolae/various_sources/Zope-2.4.1-src/lib/python/App/Factory.py", line 92, in ?
    from Product import Product
  File "/home/sirolae/various_sources/Zope-2.4.1-src/lib/python/App/Product.py", line 116, in ?
    from Factory import Factory
ImportError: cannot import name Factory

(btw, the Factory.py _has_ a Factory class definition...)
any suggestion?
Thanks,
Enrico
-- 
Enrico Sirola <enri@users.sourceforge.net>
gpg public key available from wwwkeys.pgp.net
Key fingerprint = B446 7332 ED55 BC68 5FE8  DE0F 98DF EC86 377F E07F