[ZODB-Dev] Zope Xron with ZEO?

Michel Pelletier michel@digicool.com
Thu, 5 Apr 2001 21:43:09 -0700 (PDT)


On Thu, 5 Apr 2001, Loren Stafford wrote:

> I haven't used Zope on ZEO yet, but I was thinking thru the adjustments I'd
> have to make, when I started to wonder how or whether the Xron product would
> work on ZEO....
>
> When the Xron product is initialized during Zope start-up, it starts a
> separate Dispatcher thread which sleeps until it has something to do, then
> wakes up, executes the scheduled method, updates its schedule data structure
> (which is a ZCatalog stored in ZODB), then sleeps again.
>
> In a ZEO environment, without some specific controls, there would be a
> Dispatcher thread in each client storage. All dispatchers would awaken at
> the same time, try to execute the same scheduled method, and update the same
> Schedule. That could get messy.

Yep.

> I think you only want one Dispatcher thread in the whole ZEO system.

I think you only want one Dispatcher ZEO client dedicated to being Xron.
You don't even need threads any more.  In fact, it doesn't even need to
run Zope, it just needs to interface ZEO with a ClientStorage, but you
probably want the rest of Zope around, of course, so that you know what a
Catalog is, for example.  I'd probably run zope, but the idea of removing
threading issues is apealing.  The idea in the first place was that you
wanted a thread to run in the background while the rest served your site,
but now you have a bunch of other ZEO clients to do the site serving for
you.

> I read that you can control product initialization to some degree thru the
> existence of the environment variable ZEO_CLIENT. But I can't think how to
> control initialization of specific products.

You're product would have to opt-out based on the existence of ZEO_CLIENT.
You can do this in your product's __init__ module.  Just test for
ZEO_CLIENT and return without calling any of your init code.

> Aha! Maybe the CS configuration shouldn't be identical. Maybe only one
> should have Xron installed, or maybe only one should have Xron installed in
> such a way that it is loaded at initialization time.

The latter, probably.

-Michel