[Twisted-Python] Migrate Asyncore to Twisted

glyph at divmod.com glyph at divmod.com
Thu Mar 15 16:07:18 EDT 2007

On 07:36 pm, hellojianwu at gmail.com wrote:
>>Twisted doesn't need threads for this at all. Nor does asyncore.
>> From what I understand, it is better using threads to offload any
>blocking operation out of Twisted main event loop unless all your
>message processing is non-blocking or "light-weight and fast"
>( Sometimes message processing plus state management could
>be heavy operations ).

No, it is *best* not to perform blocking operations :).

If you do need to perform "blocking" operations which are slow due to 
CPU utilization, you want to put them into a subprocess, not a thread. 
Threads are more bug-prone, and they don't perform as well, as 

Certain kinds of blocking operations are unfortunately inconvenient to 
do in subprocesses, such as SQL access; those typically go into a thread 
as a mechanism for integrating with an inherently blocking type of 
library, not as a way to avoid slow operations.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://twistedmatrix.com/pipermail/twisted-python/attachments/20070315/ce9defe1/attachment.htm 

More information about the Twisted-Python mailing list