[Twisted-Python] Help for Twisted + Thread + Message Queue

Laurens Van Houtven _ at lvh.io
Fri Oct 4 01:12:59 MDT 2013


Hi Stefano,


It's probably a good idea to avoid thinking in threads until they come up
as a potential solution.

Some questions:

1) What are the latency requirements? Is it okay for everything else to
halt while you do that computation? What are the latency requirements for
the computation? Is the data useless if you don't get it in the next n
seconds?
2) What kind of machine is it running on? Are multiple cores available, and
would it make sense to use them?
3) Do you require a lot of shared state with the process talking to the
modem in order to make the long computation?

The easiest thing to do is probably deferToThread, but you have to be
careful not to touch any state you're not supposed to touch. The second
easiest thing is probably Ampoule, a process pool, or maybe just regular
AMP, if you only want a regular process. Those would have the benefit that
the reading process is never doing anything hard, so latency should stay
predictable.

hth
lvh
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://twistedmatrix.com/pipermail/twisted-python/attachments/20131004/5cb2f8c2/attachment.html>


More information about the Twisted-Python mailing list