-
-
Notifications
You must be signed in to change notification settings - Fork 271
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Connection Pooling for Django Project #2
Comments
Hi, Have you run into a scenario where not using pgbouncer resulted in issues? Do you have an example of a configuration for it that's been known to work with a before / after comparison? |
Ohh ya, not yet for now. |
I'm interested in this too. I don't see this in the django-cookiecutter setup either so maybe not that important? |
There's pros and cons. I'm not a DBA but my surface level understanding is for single threaded applications (such as running gunicorn with 1 thread and X workers) DB pooling may slow things down. Realistically I can only trust the results I've seen in production. I've had single low powered servers happily serve hundreds of thousands of requests per month in Flask apps. DB connections weren't a bottleneck. Flask is similar enough to this Django app, both frameworks are using gunicorn with PostgreSQL using the psycopg2 package. I've never operated a site that receives hundreds of millions of daily requests. Maybe it's an issue then, my philosophy around that is I'll figure it out when it happens instead of trying to optimize for it now where it looks like it would provide worse results. |
Hi @nickjj, thank you for making this repository. I would have a look at this repo for my reference.
I'm looking for a Django project example that uses connection pooling (pgbouncer or pgpool) but seems like this repo does not use this.
My concern is because Django's DB connection is created during the request and closed after returns the response. this based on the documentation https://docs.djangoproject.com/en/3.2/ref/databases/#general-notes
I think using connection pooling would make this project better for production-ready project reference.
Thank you in advance
The text was updated successfully, but these errors were encountered: