[Twisted-Python] getting "connection per thread" behaviour

Chris Withers chris at simplistix.co.uk
Thu Apr 29 09:48:55 MDT 2010


Hi All,

I was asking about this on irc but had to leave in a hurry so thought 
I'd mail here...

So, I have a pool of wsgi threads being run by Twisted's wsgi server 
that want to send stomp messages. The stomp client is Twisted-based 
(http://code.google.com/p/broadwick/source/browse/trunk/broadwick/messaging/twistedstomp.py). 
I want to have as few stomp connections as possible, maxing out at one 
per thread.

Bonus complications:

- each wsgi thread has a logical transaction, that needs to marry up 
with the stomp logical transaction, so I can't just have one stomp 
connection per thread

- I don't know how much overhead there is in creating the stomp 
connection, so I'd like to open as few as possible but keep them open 
and re-use them across wsgi requests.

I found:

http://pypi.python.org/pypi/txconnpool

Anyone know how good that is and if it's useful here?

All help gratefully received!

Chris





More information about the Twisted-Python mailing list