django
django copied to clipboard
Disable persistent database connections for ASGI compatibility
trafficstars
Summary
- Set
conn_max_age=0in database configuration to disable persistent connections - This change is recommended by Django documentation for ASGI applications
Background
When using ASGI, persistent connections can cause issues with connection pool exhaustion and resource contention. Each long-lived ASGI connection could hold its own persistent database connection, quickly exhausting the database connection pool.