Hello Simon.

On Monday, May 14, 2018 at 6:15:50 PM UTC+1, Simon Charette wrote:
>
> > Is there a way to force Django to close the DB connection after each 
> operation (unless we're in an atomic block)?
>
> The only way I can think of achieving that is by bundling your own 
> database backend subclass
> and override execute() and the cursor subclass to close the connection 
> when appropriate.
>

Thanks for the suggestion, I will take a look at it.
 

> Is there any reason you opted for an in-application connection pool 
> instead of using
> pgbouncer or pgpool instead?
>

There are several reasons:
- I would have to configure Django to open a new connection to the pooling 
component at each request and, well, we've moved past PHP at this time... :)
- I have zero experience with either pgbouncer or pgpool, and they both 
seem to perform the same tasks, so it would be yet another decision that I 
would have to make and using only second-hand experience. In addition, none 
of them seem to have official Docker images.
- Another component that I would have to manage, and I already have an 
sqlproxy component between Django and the DB when I need to access Cloud 
SQL instances in GCP.
- Doubling of the number of connections of the server, the same amount of 
web client connections would be reflected in DB connections to the pooler 
component.
- All in all IMO the connection pooling problem is better handled in 
process, and it's not rocket science, there are already libs for this, I'm 
just missing 10% help from Django.

Thank you and best regards,
André

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/52a479a3-ae6f-47ba-b55e-df590bf0b26f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to