[Twisted-Python] Migrate Asyncore to Twisted
glyph at divmod.com
glyph at divmod.com
Thu Mar 15 14:07:18 MDT 2007
On 07:36 pm, hellojianwu at gmail.com wrote:
>Hi,
>>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
processes.
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: </pipermail/twisted-python/attachments/20070315/ce9defe1/attachment.html>
More information about the Twisted-Python
mailing list