Recently I've been receiving this error regarding what appears to be an insufficiency in connection slots along with many of these Heroku errors:
H18 - Request Interrupted H19 - Backend connection timeout H13 - Connection closed without response H12 - Request timeout
Error
django.db.utils.OperationalError in /
FATAL: remaining connection slots are reserved for non-replication superuser connections
Current Application setup:
- Django 1.7.4
- Postgres
- Heroku (2x 2 dynos, Standard-2) 5ms response time, 13rpm Throughput
Are there general good practices for where one should or should not perform querysets in a Django application, or when to close a database connection?
I've never experienced this error before. I have increased my dynos on heroku and allocated significantly more RAM and I am still experiencing the same issue.
I've found similar questions on Stack Overflow but I haven't been able to figure out what might be causing the issue exactly.
I have querysets in Model methods, views, decorator views, context processors.
My first inclination would be that there is an inefficient queryset being performed somewhere causing connections to remain open that eventually crashes the application with enough people accessing the website.
Any help is appreciated. Thanks.