<html><body>On 07:36 pm, hellojianwu@gmail.com wrote:<br />&gt;Hi,<br />&gt;&gt;Twisted doesn't need threads for this at all. Nor does asyncore.<br />&gt;<br />&gt;&gt; From what I understand, it is better using threads to offload any<br />&gt;blocking operation out of Twisted main event loop unless all your<br />&gt;message processing is non-blocking or "light-weight and fast"<br />&gt;( Sometimes message processing plus state management could<br />&gt;be heavy operations ).<br /><br />No, it is *best* not to perform blocking operations :).<br /><br />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. &#160;Threads are more bug-prone, and they don't perform as well, as processes.<br /><br />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.</body></html>