Hello, we use bundle of gunicorn+django+dramatiq+gevent and rabbitmq as message broker. Gunicorn gevent worker class creates new greenlet for each new request. Dramatiq creates an amqp connection first time as it needs to send message. But after request is processed amqp connection remains opened and this connection will be not used again. Of course connection will be closed by rabbit. But it's not good and takes some time and resources. I've solved this issue with django middleware (i can create PR). Maybe is there some better solution ?
@horpto
Can you post an example with implementation? Will adding this middleware to the end of the chain for DRAMATIQ_BROKER -> MIDDLEWARE solve the connection issue?
Hello, we use bundle of gunicorn+django+dramatiq+gevent and rabbitmq as message broker. Gunicorn
gevent
worker class creates new greenlet for each new request. Dramatiq creates an amqp connection first time as it needs to send message. But after request is processed amqp connection remains opened and this connection will be not used again. Of course connection will be closed by rabbit. But it's not good and takes some time and resources. I've solved this issue with django middleware (i can create PR). Maybe is there some better solution ?