[Twisted-Python] synchronous/asynchronous api: possible interface

2009-11-13 Thread Doug Farrell
Hi all, I'd like to get some comments on the code below (including, "don't be a bonehead!" ). I'm trying to write a API library for database access that can be used by both synchronous (non-twisted, no reactor) code and asynchronous (twisted, with reactor) code where the methods of the library can

[Twisted-Python] Deferred SOAP methods

2009-11-13 Thread Landreville
I am making a SOAP server and all (or at least the vast majority) will be returning a deferred. The whole SOAP method is encapsulated in a deferred in most of my cases (I havent implemented this part yet.) Then I got the idea that twisted.web.soap could just wrap my SOAP method (retrieved with look

Re: [Twisted-Python] synchronous/asynchronous api: possible interface

2009-11-13 Thread exarkun
On 02:32 pm, doug.farr...@gmail.com wrote: >Hi all, > >I'd like to get some comments on the code below (including, "don't be >a bonehead!" ). I'm trying to write a API library for database >access that can be used by both synchronous (non-twisted, no reactor) >code and asynchronous (twisted, with r

Re: [Twisted-Python] Deferred SOAP methods

2009-11-13 Thread exarkun
On 02:52 pm, landrevi...@deadtreepages.com wrote: >I am making a SOAP server and all (or at least the vast majority) will >be >returning a deferred. The whole SOAP method is encapsulated in a >deferred in >most of my cases (I havent implemented this part yet.) Then I got the >idea >that twisted.

Re: [Twisted-Python] Deferred SOAP methods

2009-11-13 Thread Landreville
On Fri, Nov 13, 2009 at 10:25 AM, wrote: > On 02:52 pm, landrevi...@deadtreepages.com wrote: > >I am making a SOAP server and all (or at least the vast majority) will > >be > >returning a deferred. The whole SOAP method is encapsulated in a > >deferred in > >most of my cases (I havent implemented

Re: [Twisted-Python] Multi-reactor architecture

2009-11-13 Thread vitaly
Doesn't the event loop have a limit of connections it could handle? Quoting "Reza Lotun" : >> hi, >> what would be the right thing to start from in order to build >> multi-reactor arch to handle thousands of concurrent connections? > > Why would you want multiple reactors? The only reason would

Re: [Twisted-Python] Multi-reactor architecture

2009-11-13 Thread exarkun
On 03:59 pm, vit...@synapticvision.com wrote: > >Doesn't the event loop have a limit of connections it could handle? Multiple reactors isn't a realistic solution to this. The solution is to switch to an event loop that has a higher limit. "The" event loop is actually a choice of many possible

Re: [Twisted-Python] Multi-reactor architecture

2009-11-13 Thread vitaly
I've get confused enough already :-)) Once there is a Site that serving many clients and reactor.listenSSL(), for example, that actually serving many TCP connections and all these going through TwistedGateway, my logic, please correct me if I wrong, says at some point there will be a limit

Re: [Twisted-Python] Multi-reactor architecture

2009-11-13 Thread Reza Lotun
> Once there is a Site that serving many clients and > reactor.listenSSL(), for example, that actually serving many TCP > connections and all these going through TwistedGateway, my logic, > please correct me if I wrong, says at some point there will be a limit > on concurrent TCP connections, so ho

Re: [Twisted-Python] Multi-reactor architecture

2009-11-13 Thread vitaly
thank you for such detailed response. I feel, finally I've succeed to express my original question correctly. So if I go one step forward, and lets assume that indeed there is such limit of concurrent connections, THAN: should it be resolved by another architecture or another usage type of Tw

Re: [Twisted-Python] Multi-reactor architecture

2009-11-13 Thread Reza Lotun
> thank you for such detailed response. > I feel, finally I've succeed to express my original question correctly. > > So if I go one step forward, and lets assume that indeed there is such > limit of concurrent connections, THAN: > should it be resolved by another architecture or another usage type

Re: [Twisted-Python] Multi-reactor architecture

2009-11-13 Thread vitaly
So if I get stick to the "vertical scalability"(Site has sessions), is it gonna be helpful for performance to run Twisted reactor on a single core machine vs multi-core machine (after all Python itself has a Global Interpreter Lock)? OR the entire "TwsitedGateway+listenSSL+Site+reactor" USAG

Re: [Twisted-Python] synchronous/asynchronous api: possible interface

2009-11-13 Thread Tom Leys
Hi Doug. I think that a decorator is a fairly nice idea, however you will probably run into the following issue: http://twistedmatrix.com/trac/ticket/2066 Once a reactor has been started and stopped, starting the reactor again will crash your program. You will need to come up with a way to get

Re: [Twisted-Python] Deferred SOAP methods

2009-11-13 Thread exarkun
On 03:42 pm, landrevi...@deadtreepages.com wrote: >On Fri, Nov 13, 2009 at 10:25 AM, wrote: > >[snip] >> >>What is it that you're going to be doing in these SOAP methods? >> >>Jean-Paul >They are doing a bunch of setting and retrieving information from >databases. >There are a couple that load mo

Re: [Twisted-Python] synchronous/asynchronous api: possible interface

2009-11-13 Thread exarkun
On 04:03 pm, doug.farr...@gmail.com wrote: >Jean-Paul, > >Thanks for the "heads up", that certainly falls under the D'OH! >category. Would you have any suggestions for how I might do this kind >of thing? I already mentioned SynchronousDeferred, so I guess you're not interested in that. :) The

Re: [Twisted-Python] Deferred SOAP methods

2009-11-13 Thread Landreville
On Fri, Nov 13, 2009 at 3:46 PM, wrote: > On 03:42 pm, landrevi...@deadtreepages.com wrote: > >On Fri, Nov 13, 2009 at 10:25 AM, wrote: > > > >[snip] > >> > >>What is it that you're going to be doing in these SOAP methods? > >> > >>Jean-Paul > >They are doing a bunch of setting and retrieving in