akvo / akvo-provisioning

Server and development environment provisioning data and configurations
9 stars 2 forks source link

RSR Postgres connections #143

Open kardan opened 9 years ago

kardan commented 9 years ago

Background

Django 1.6 supports keeping connection between requests. At the moment we create new connections for new requests, which is a bit expensive. We should review if we want to use that, and if so what settings to use.

State of the RSR

It's difficult to know if the change of connections will generate a noticeable effect since we don't have a lot of traffic. But still seems like something we should review.

To be decided

Do we think we can use unlimited persistent connections from RSR or should we use a TTL? Is the default 100 connections a reasonable setting?

Ref

https://docs.djangoproject.com/en/1.6/ref/settings/#std:setting-CONN_MAX_AGE http://www.postgresql.org/docs/9.1/static/runtime-config-connection.html

kardan commented 9 years ago

@orifito @carlio you guys have any insights in this?

orifito commented 9 years ago

We are not going to generate an immediate palpable effect, but for sure it's so much better to use connection pooling. Actually, we could also contemplate the use of a standalone pooler like PgBouncer https://wiki.postgresql.org/wiki/PgBouncer. Need to investigate to take a decision, but taking into account that now we have both mysql and psql running into the same host, I would not increase the default max connections. All in all, it seems PgBouncer could give us potential benefits, and even more if we could use it in transaction pooling mode.