django-rq icon indicating copy to clipboard operation
django-rq copied to clipboard

persistent database connections?

Open ccurvey opened this issue 7 years ago • 2 comments

Is there a way to tell django-rq to re-use database connections? It appears from my logs that a new Postgres connection is being opened for every job that is executed. (And it's killing my performance.)

ccurvey avatar Mar 23 '17 17:03 ccurvey

Not at the moment, Django-RQ explicitly closes all DB connections prior to calling os.fork() and executing jobs.

Suggestions on how we can make this more efficient is welcome.

selwin avatar Aug 07 '17 10:08 selwin

You should probably use something like pgbouncer to pool postgres connections instead of building this into django-rq. Configuration is pretty simple. In fact, you should be using a connection pooler for Django app too.

edmenendez avatar Oct 30 '18 19:10 edmenendez