<html><body>On 07:36 pm, hellojianwu@gmail.com wrote:<br />>Hi,<br />>>Twisted doesn't need threads for this at all. Nor does asyncore.<br />><br />>> From what I understand, it is better using threads to offload any<br />>blocking operation out of Twisted main event loop unless all your<br />>message processing is non-blocking or "light-weight and fast"<br />>( Sometimes message processing plus state management could<br />>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.  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>