Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

django 1.7 and connection pooling to PostgreSQL?

What are the differences between the django apps (Django-PostgresPool, djorm-ext-pool, django-db-pool) and PG Bouncer or PG Pool?

Do the apps use one of the last two packages?

In this article, the author says that there is a patch starting with django 1.6. Does that mean we do not have to use any of these solutions anymore, neither the apps, nor the PG Bouncer or PG Pool package?

like image 410
Michael Avatar asked Oct 20 '14 16:10

Michael


1 Answers

Postgres database connections are expensive (resources) compared to MySQL connections. Django pooling apps will open many connections and keep the open.

PG Bouncer and PG Pool will open fewer connections to Postgres, while maintaining a large number of local connections (app to PG Bouncer/PG Pool) and reuse them.

For best performance you want both: persistent connections from Django to PG Pool / PG Bouncer.

In our case switching persistent connections reduced average response time by 10ms (over 20%) on AWS.

like image 144
c2h5oh Avatar answered Oct 01 '22 08:10

c2h5oh