Hello everyone, Thanks Jean-Paul for the tips! Now, I figured out that this thread was calling some callbacks, which in turn were either sending some UDP using a child of Twisted's datagram protocol, or launching processes using t.p.procutils.which and t.i.utils.getProcessOutputAndValue. None of this is guaranteed to be thread-safe, according to http://twistedmatrix.com/documents/current/core/howto/threading.html.
I just added a reactor.callFromThread before calling my callbacks, and it should now be much faster... Best, 2014-12-06 13:47 GMT-05:00 <exar...@twistedmatrix.com>: > On 06:15 pm, alexan...@quessy.net wrote: > >> Hello everyone, >> >> What happens if some code starts a thread while I am using Twisted's >> reactor? >> > > Nothing special. > >> Here is what I need to use: >> https://github.com/ekulyk/PythonPusherClient/blob/master/pusherclient/ >> connection.py#L12 >> >> This thread polls some socket to handle received TCP messages. It appears >> it has been very slow in production. Is it this mix of twisted and >> non-twisted threading that causes this brutal slowdown? >> > > Not likely. Twisted doesn't have its own threading implementation. > Twisted has a threadpool module which is a thin layer on top of Python's > threading module. > >> If so, how can I >> easily speed it up without having to twistify the library I need to use? >> (and practically rewrite it) >> > > Profile it. Find the particular operations that are slow. Then you'll be > one step closer to knowing how to speed things up. > > Jean-Paul > > _______________________________________________ > Twisted-Python mailing list > Twisted-Python@twistedmatrix.com > http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python > -- Alexandre Quessy - 亚历山大 - ألكسندر http://alexandre.quessy.net - Artiste en nouveaux médias http://perte-de-signal.org - Membre de Perte de signal http://sourcelibre.net - Développement logiciel et conception de sites Web http://labalab.ca - Impliqué dans LabàLab - communauté de pratique en arts numériques
_______________________________________________ Twisted-Python mailing list Twisted-Python@twistedmatrix.com http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python