Following this code without ability to set GUNICORN_WORKERS we have number of workers equal to number_of_cpus*4+1.
Django's default behaviour is to open connection per worker for GUNICORN_WORKERS times and keep them opened for CONN_MAX_AGE seconds.
CONN_MAX_AGE is strictly set right in code for 600 seconds and max_connections parameter of PostgreSQL in deis-database strictly set to 100 too.
So, lets imagine, we have a big metal chassis with 40 CPUs.
Our GUNICORN_WORKERS variable will be equal to 40*4+1=161 (which is already greater than 100), also, we have CONN_MAX_AGE parameter equal to 600 seconds.
This way after 500 seconds (health check is once per 5 seconds, 100 times) queries like SELECT 0 which are results of health check will own all 100 connections to PostgreSQL.
Following this code without ability to set
GUNICORN_WORKERSwe have number of workers equal tonumber_of_cpus*4+1.Django's default behaviour is to open connection per worker for
GUNICORN_WORKERStimes and keep them opened forCONN_MAX_AGEseconds.CONN_MAX_AGEis strictly set right in code for 600 seconds andmax_connectionsparameter of PostgreSQL indeis-databasestrictly set to100too.So, lets imagine, we have a big metal chassis with 40 CPUs.
Our
GUNICORN_WORKERSvariable will be equal to40*4+1=161(which is already greater than 100), also, we haveCONN_MAX_AGEparameter equal to 600 seconds.This way after 500 seconds (health check is once per 5 seconds, 100 times) queries like
SELECT 0which are results of health check will own all 100 connections to PostgreSQL.