[Twisted-Python] Serious performance problem of twisted

Thomas Hervé therve at free.fr
Sun Oct 19 08:03:03 EDT 2008


Le dimanche 19 octobre 2008 à 19:38 +0800, davy zhang a écrit :
> a very simple server and multi-process code, I found there's about 500
> milliseconds delay for every msg I sent to client I just don't why,
> did I made something wrong ?

Short answer:
http://twistedmatrix.com/trac/wiki/FrequentlyAskedQuestions#WhydoesittakealongtimefordataIsendwithtransport.writetoarriveattheothersideoftheconnection

A bit more elaborated: yes, you did something wrong. The Twisted APIs
are not threadsafe, thus you must not call any Twisted method from a
thread, except reactor.callFromThread. See
http://twistedmatrix.com/projects/core/documentation/howto/threading.html for more information.


-- 
Thomas





More information about the Twisted-Python mailing list