python - Django not reusing connections to MySQL with CONN_MAX_AGE=60 -
i using django 1.9.2 in development (debug=true
) mysql 5.6.23. below database settings
databases = { 'default': { 'engine': 'django.db.backends.mysql', 'name': 'dbname', 'user': "django", 'password': 'password', 'host': 'localhost', 'port': '3306', 'conn_max_age': 60, } }
i querying mysql number of active connections command below:
show status `variable_name` = 'threads_connected';
it yield result
+-------------------+-------+ | variable_name | value | +-------------------+-------+ | threads_connected | 10 | +-------------------+-------+ 1 row in set (0,00 sec)
every time make new request django, number of connected threads increase until (1040, 'too many connections')
when number threads_connected=151
. furthermore, connections not closed after 60s.
this behavior not seem happen in production (debug=false
).
Comments
Post a Comment