Improve docs for ARA_DATABASE_CONN_MAX_AGE

Provide better advice for tuning CONN_MAX_AGE based on the use case.

Change-Id: Iab2859254a5288f9b3e13a2640ea7de96dcbc27c
This commit is contained in:
David Moreau Simard 2020-01-24 18:34:03 -05:00
parent e6d48350c0
commit 3678d45297
No known key found for this signature in database
GPG Key ID: 938880DAFC753E80
1 changed files with 14 additions and 2 deletions

View File

@ -186,9 +186,21 @@ ARA_DATABASE_CONN_MAX_AGE
- **Type**: ``integer``
- **Default**: ``0``
The lifetime of a database connection, in seconds.
The lifetime of a database connection, in seconds, before it is recycled by
Django.
The default of 0 closes database connections at the end of each request.
The default of ``0`` results in connections being closed automatically
after each request and is appropriate if the API server is not running as a
persistent service.
When running the API server as a persistent service, this setting can be
increased to values such as ``300`` in order to enable persistent connections
and avoid the performance overhead of re-establishing connections for each
request.
When using the ``django.db.backends.mysql`` database engine, this value should
be lower than the MySQL server's ``wait_timeout`` configuration to prevent the
database server from closing the connection before Django can complete queries.
ARA_DATABASE_ENGINE
~~~~~~~~~~~~~~~~~~~