ZAsync for asynchronous Zope actions part #2
I have successfully set up and used ZAsync for webmail folder
synchronisations, here's a small summary on what I have done.
Setting up ZAsync with Zeo
The first step was to set up a zeo installation with a few zope nodes.This
is quite easy and usual, thanks to Zope smart architecture.
Then I have installed zasync product and created a singleton object called
"Asynchronous Call Manager" in the root of the Zope.
This object provides a few methods that can be called to delegate some work
The next step was to launch the ZAsync client that will actually run
asynchronous calls on the ZODB.
ZAsync comes with a nice conf file, similar to the zope one, where you can
provide informations like the adress and port of the ZEO server and set up
things like logging or path.
path configuration is very important for instance, when you run a
When everything is set up, the client is launched and listen to
incoming calls, sent by the Asynchronous Call Manager
How does it work ?
Zasync maintains a custom BTree called BForest, that holds commands to be
run. Commands to be run are sent to an object called Asyncrhonous Call
Manager. A client is launched besides Zope. The client looks upon the tree
to see if there's some tasks to do and run them.
Why webmail needs more features
Now using one asynchronous call manager with one client can't be enough for
a webmail that's supposed to handle something like 3000 people on a
I need to run several zasync clients on several servers to speed up
background processes. I was starting to think about it when Gary Poster told
me how to do it :
Setting up several asynchronous call manager, each one with a dedicated
client. and make some kind of top function to send calls to call managers,
with load balancing.
This is easy to set up since we can specify in the client conf file
the target call manager.
Since this mechanism will propably be needed in other projects, I have
decided to create a small Zope product in charge of all zasync clients, that
will keep a collection of asynchronous call manager and distribute calls to
them according to their load.
This product will probably be callable in a high level way and fully
integrated to our CMS.
Stay tuned for part #3, with a first version of ZAsyncLoadBalancer
(Post originally written by Tarek Ziadé on the old Nuxeo blogs.)
Category: Product & Development