I had a problem with a Django application that exceeds the maximum number of concurrent connections (100) to Postgres when working through Gunicornasync eventletworkers. When it reaches the connection limit, the application will start returning 500-errors until new connections are established.
This is my database configuration:
DATABASES = {
'default': {
'ENGINE': 'django.contrib.gis.db.backends.postgis',
'NAME': 'django',
'USER': 'django',
'HOST': 'postgres',
'PORT': 5432,
'CONN_MAX_AGE': 60,
}
}
This is how Gunicorn starts:
gunicorn --bind 0.0.0.0:8080 --worker-class eventlet --workers 5 myapp.wsgi:application
These are the installed packages:
- djano v1.7
- gunicorn v19.3
- eventlet v0.17
- psycopg2 v2.6
Can't Django Reuse HTTP Request Connections When Working With Gunicorn Workers? Is some kind of third-party database connection pool my only option?
15-03-23: , CONN_MAX_AGE Gunicorn. , , . CONN_MAX_AGE 0 Django , , .