[ZODB-Dev] Re: ZEO and Twisted

Jim Fulton jim at zope.com
Tue Apr 25 09:53:15 EDT 2006


Florent Guillaume wrote:
> On 25 Apr 2006, at 15:23, Jim Fulton wrote:
> 
>> Florent Guillaume wrote:
>>
>>> [Ccing zodb-dev]
>>> On 25 Apr 2006, at 15:09, David Pratt wrote:
>>>
>>>>> The protocol is simple yes, but the iteractions w.r.t threading   
>>>>> are sometimes subtle.
>>>>
>>>>
>>>>
>>>> Hi Florent.  This could be set up using a twisted's application   
>>>> object so that you have a twisted app using a twisted .tac. I  
>>>> guess  this could still use the .conf as in this but twisted  
>>>> already has a  means of daemonizing its services with twisted.  This 
>>>> would give you  something like this to start up zeo.
>>>>
>>>> twistd -y zeo.tac
>>>>
>>>> What are your thoughts?
>>>
>>> Huh, I thought you were talking about the ZEO client,  
>>> ClientStorage,  not the ZEO server.
>>> For the ZEO server I don't see the point of changing it, it works  well.
>>> OTOH a ClientStorage has to integrate with the other servers in  
>>> Zope,  and that's the one that would benefit from being moved to  the 
>>> twisted  event loop if twisted is used.
>>
>>
>> (I'm mostly not paying attention to this thread but I have to speak  up.)
>>
>> I disagree.  ZEO should not be dependent on an application main loop
>> at all.  It was a mistake to couple ZEO's networking at an  application's
>> asyncore main loop.  This *greatly* complicated ZEO's implementation.
>> I'd much rather that ZEO's networking be independent of
>> an application.  Fortunately, asyncore allows multiple independent  
>> main loops.
>> Does Twisted?
> 
> 
> When I propose to move it to the twisted event loop, I mean refactor  it 
> so that you can plug it into whatever main loop you want, with  nice 
> entry points.
> Today the code that has to switch depending on whether TheadedAsync  is 
> available or not, for example, is horrible.

Well, first, making ZEO's networking that pluggable would be a very
major refactoring.  The twisted and syncore apis are quite
different.

Second, you don't want to plug into the application's main loop
because you generally want to do database operations before the
main loop has started.  That is the reason for the horrible code
you mention.  IMO, it would be far better to give the database it's
own main loop.  Then you don't need to plug into anything. This is
my long-term plan for ZEO.

I also do contemplate a major change to ZEO's networking code. The
main reason is to make it more testable.  This could also make it
more pluggable.  Sadly, it will be a long time before I have time to
work on this. :(

Jim

-- 
Jim Fulton           mailto:jim at zope.com       Python Powered!
CTO                  (540) 361-1714            http://www.python.org
Zope Corporation     http://www.zope.com       http://www.zope.org


More information about the ZODB-Dev mailing list