On Sunday, 9 March 2014 04:31:38 UTC-7, hynek wrote:
>
> On 9 Mar 2014, at 12:20, Chris Withers wrote: 
>
> > Aside from that, what's people's experience/recommendations when it 
> comes to the plethora of async stuff currently available? 
> > twisted, tornado, tulip or even good old fashioned asyncore seem like 
> possibilities, I'm wondering which way to go 
>
> Whatever you do, keep your fingers off asyncore, that’s a complete turd 
> unfortunately (hence tulip).  As for Twisted, you can use it within 
> synchronous projects via https://pypi.python.org/pypi/crochet/ now.


I had success with the inverse approach, running the synchronous wsgi app 
within the twisted wsgi 
server: 
http://twistedmatrix.com/documents/current/web/howto/web-in-60/wsgi.html 
then calling back into twisted from the wsgi app via 
blockingCallFromThread: 
 https://twistedmatrix.com/documents/current/core/howto/threading.html

Twisted is definitely the way to go if you need access to its extensive 
collection of network protocol libraries. Otherwise, I think it probably 
depends on how much async code you need to write. With gevent you code in 
essentially the same style as you would with standard multithreading. 
That's great in terms of being able to work with existing synchronous code, 
and so long as you don't have mutable shared state between threads (i.e. 
they all just wrap async network calls to some external system) then you 
should be fine. Otherwise you have all the usual problems of threads to 
deal with. (While you only switch threads cooperatively, any function you 
call could potentially lead to context switching.)

Laurence

-- 
You received this message because you are subscribed to the Google Groups 
"pylons-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/pylons-discuss.
For more options, visit https://groups.google.com/d/optout.

Reply via email to