Take the 2-minute tour ×
Stack Overflow is a question and answer site for professional and enthusiast programmers. It's 100% free, no registration required.

I was looking at db connection pool implementations to use in my Django app using postgresql db backend, and came across this very recent wrapper package implemented for psycopg2 -

https://pypi.python.org/pypi/django-db-pool

psycopg2 in itself offers different types of pools i.e. Simple (shared across single thread), Threaded (shared across threads) and Persistent (strictly one persisted connection per thread), according to the docs here - http://initd.org/psycopg/docs/pool.html.

djang-db-pool seems to be using the ThreadedConnectionPool implementation, as seen from the source code.

Currently, in my Django app implementation, each request can spawn off multiple threads, which means to handle multiple concurrent Django requests, is ThreadedConnectionPool the right way to go ?

Does anybody else have some experience using this package (django-db-pool) or psycopg2 connection pool with Django and can throw some light on this ?

share|improve this question
add comment

1 Answer

As the docs you linked to note, ThreadedConnectionPool is the one you want to use for multi-threaded applications, which Django is (or can be anyway, depending upon how you've configured your web server / WSGI interface.) I wrote django-db-pool so I'm not an impartial source, but perhaps you could explain your request flow so I could offer some additional advice?

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.