[ZODB-Dev] Newbe ZODB questions

Jeremy Hylton jeremy@alum.mit.edu
Wed, 30 May 2001 13:06:16 -0400 (EDT)


>>>>> "PD" == Patrick Down <pdown@austin.rr.com> writes:

  PD> 1. I see multiple storages talked about in the documentation but
  PD>    it is unclear if they are implemented.

It is possible to use multiple storages, as I know that Ethan does
this with zope.org.  I'm afraid I don't know anything more about how
to configure this.

  PD> Does ZODB support having more than one storage open?  How would
  PD> I associate persistent objects with one or the other?

Do you need to have more than one storage?  Why can't you put all the
objects in a single storage?

  PD> 2. I see in the news groups and mail archives some discussion
  PD>    about ZODB
  PD> being much better for more "read" and less "write" intensive
  PD> applications.  My application is fairly read/write balanced.
  PD> However only small subsections of the document are changed at
  PD> any one time.  A large document might contain as many as 10K to
  PD> 20K objects but only 100 might be modified and committed at one
  PD> time.  Should ZODB perform well in a situation like this? 

Hard to say what you mean by "well."  What are you performance
requirements?  

The fact that you write 100 objects doesn't sound like a big problem.
The main issue I would worry about is whether there is much potential
for conflicting updates.  If two different transactions -- two
different threads in a single process and two different processes
using the same storage with ZEO -- update the same object at the same
time, one will fail with a ConflictError.  When you get a
ConflictError, you should abort the transaction and try it again.  If
there is little contention, there's no problem.  If several threads
are updating the same objects concurrently, the frequency of
ConflictErrors increases and the program wastes more time on work that
is ultimately aborted.

  PD> I also have seen discussion that the FileStorage grows with every
  PD> write and needs to be periodically compressed.  Is this true?

Yes.  Many ZODB storages keep a revision history for each object, so
that you can undo changes.  If you run a FileStorage, each write will
increase the total storage.  You need to pack periodically to remove
the old revisions.  You can also use a storage like the bsddb3Storage
Packless storage with does not keep revisions, but then you can't undo
changes.

Jeremy