From 4cdd0e05b758d667289418f1f9410358c7477522 Mon Sep 17 00:00:00 2001 From: Andrew Thornton Date: Tue, 15 Oct 2019 20:26:13 +0100 Subject: [PATCH 01/11] Expose db.SetMaxOpenConns and allow other dbs to set their connection params --- custom/conf/app.ini.sample | 8 +++++--- .../doc/advanced/config-cheat-sheet.en-us.md | 5 +++-- models/models.go | 8 +++----- modules/setting/database.go | 16 ++++++++++++---- 4 files changed, 23 insertions(+), 14 deletions(-) diff --git a/custom/conf/app.ini.sample b/custom/conf/app.ini.sample index 08a2c8e32f5c..c9a0540a2ab6 100644 --- a/custom/conf/app.ini.sample +++ b/custom/conf/app.ini.sample @@ -286,10 +286,12 @@ LOG_SQL = true DB_RETRIES = 10 ; Backoff time per DB retry (time.Duration) DB_RETRY_BACKOFF = 3s -; Max idle database connections on connnection pool, default is 0 +; Max idle database connections on connnection pool, default is 2 or 0 on mysql MAX_IDLE_CONNS = 0 -; Database connection max life time, default is 3s +; Database connection max life time, default is 0 or 3s mysql CONN_MAX_LIFETIME = 3s +; Database maximum number of open connections, default is 0 meaning no maximum +MAX_OPEN_CONNS = 0 [indexer] ; Issue indexer type, currently support: bleve or db, default is bleve @@ -834,6 +836,6 @@ TOKEN = QUEUE_TYPE = channel ; Task queue length, available only when `QUEUE_TYPE` is `channel`. QUEUE_LENGTH = 1000 -; Task queue connction string, available only when `QUEUE_TYPE` is `redis`. +; Task queue connction string, available only when `QUEUE_TYPE` is `redis`. ; If there is a password of redis, use `addrs=127.0.0.1:6379 password=123 db=0`. QUEUE_CONN_STR = "addrs=127.0.0.1:6379 db=0" diff --git a/docs/content/doc/advanced/config-cheat-sheet.en-us.md b/docs/content/doc/advanced/config-cheat-sheet.en-us.md index 6fb92f27218c..3bee84562a19 100644 --- a/docs/content/doc/advanced/config-cheat-sheet.en-us.md +++ b/docs/content/doc/advanced/config-cheat-sheet.en-us.md @@ -173,8 +173,9 @@ Values containing `#` or `;` must be quoted using `` ` `` or `"""`. - `LOG_SQL`: **true**: Log the executed SQL. - `DB_RETRIES`: **10**: How many ORM init / DB connect attempts allowed. - `DB_RETRY_BACKOFF`: **3s**: time.Duration to wait before trying another ORM init / DB connect attempt, if failure occured. -- `MAX_IDLE_CONNS` **0**: Max idle database connections on connnection pool, default is 0 -- `CONN_MAX_LIFETIME` **3s**: Database connection max lifetime +- `MAX_IDLE_CONNS` **2 or 0**: Max idle database connections on connnection pool, default is 2 (except on MySQL where it 0) +- `CONN_MAX_LIFETIME` **0 or 3s**: Database connection max lifetime - default is 0, meaning there is no limit (except on MySQL where it is 3s) +- `MAX_OPEN_CONNS` **0**: Database maximum open connections - default is 0, meaning there is no limit. ## Indexer (`indexer`) diff --git a/models/models.go b/models/models.go index ea550cb839fe..8dbe485d86b0 100644 --- a/models/models.go +++ b/models/models.go @@ -157,11 +157,9 @@ func SetEngine() (err error) { // so use log file to instead print to stdout. x.SetLogger(NewXORMLogger(setting.Database.LogSQL)) x.ShowSQL(setting.Database.LogSQL) - if setting.Database.UseMySQL { - x.SetMaxIdleConns(setting.Database.MaxIdleConns) - x.SetConnMaxLifetime(setting.Database.ConnMaxLifetime) - } - + x.SetMaxIdleConns(setting.Database.MaxIdleConns) + x.SetConnMaxLifetime(setting.Database.ConnMaxLifetime) + x.SetMaxOpenConns(setting.Database.MaxOpenConns) return nil } diff --git a/modules/setting/database.go b/modules/setting/database.go index 2cac4824dfbc..4ca2dfb45198 100644 --- a/modules/setting/database.go +++ b/modules/setting/database.go @@ -42,12 +42,14 @@ var ( DBConnectRetries int DBConnectBackoff time.Duration MaxIdleConns int + MaxOpenConns int ConnMaxLifetime time.Duration IterateBufferSize int }{ Timeout: 500, - MaxIdleConns: 0, - ConnMaxLifetime: 3 * time.Second, + MaxIdleConns: 2, + ConnMaxLifetime: 15 * time.Minute, + MaxOpenConns: 0, } ) @@ -80,8 +82,14 @@ func InitDBConfig() { Database.Charset = sec.Key("CHARSET").In("utf8", []string{"utf8", "utf8mb4"}) Database.Path = sec.Key("PATH").MustString(filepath.Join(AppDataPath, "gitea.db")) Database.Timeout = sec.Key("SQLITE_TIMEOUT").MustInt(500) - Database.MaxIdleConns = sec.Key("MAX_IDLE_CONNS").MustInt(0) - Database.ConnMaxLifetime = sec.Key("CONN_MAX_LIFE_TIME").MustDuration(3 * time.Second) + if Database.UseMySQL { + Database.MaxIdleConns = sec.Key("MAX_IDLE_CONNS").MustInt(0) + Database.ConnMaxLifetime = sec.Key("CONN_MAX_LIFE_TIME").MustDuration(3 * time.Second) + } else { + Database.MaxIdleConns = sec.Key("MAX_IDLE_CONNS").MustInt(2) + Database.ConnMaxLifetime = sec.Key("CONN_MAX_LIFE_TIME").MustDuration(0) + } + Database.MaxOpenConns = sec.Key("MAX_OPEN_CONNS").MustInt(0) Database.IterateBufferSize = sec.Key("ITERATE_BUFFER_SIZE").MustInt(50) Database.LogSQL = sec.Key("LOG_SQL").MustBool(true) From 03dbb9b004fc204436154018721a743d71c39ec3 Mon Sep 17 00:00:00 2001 From: zeripath Date: Wed, 16 Oct 2019 07:00:29 +0100 Subject: [PATCH 02/11] Apply suggestions from code review Co-Authored-By: guillep2k <18600385+guillep2k@users.noreply.github.com> --- custom/conf/app.ini.sample | 6 +++--- docs/content/doc/advanced/config-cheat-sheet.en-us.md | 2 +- modules/setting/database.go | 3 --- 3 files changed, 4 insertions(+), 7 deletions(-) diff --git a/custom/conf/app.ini.sample b/custom/conf/app.ini.sample index c9a0540a2ab6..540d71e286ca 100644 --- a/custom/conf/app.ini.sample +++ b/custom/conf/app.ini.sample @@ -286,8 +286,8 @@ LOG_SQL = true DB_RETRIES = 10 ; Backoff time per DB retry (time.Duration) DB_RETRY_BACKOFF = 3s -; Max idle database connections on connnection pool, default is 2 or 0 on mysql -MAX_IDLE_CONNS = 0 +; Max idle database connections on connnection pool, default is 2 +MAX_IDLE_CONNS = 2 ; Database connection max life time, default is 0 or 3s mysql CONN_MAX_LIFETIME = 3s ; Database maximum number of open connections, default is 0 meaning no maximum @@ -836,6 +836,6 @@ TOKEN = QUEUE_TYPE = channel ; Task queue length, available only when `QUEUE_TYPE` is `channel`. QUEUE_LENGTH = 1000 -; Task queue connction string, available only when `QUEUE_TYPE` is `redis`. +; Task queue connection string, available only when `QUEUE_TYPE` is `redis`. ; If there is a password of redis, use `addrs=127.0.0.1:6379 password=123 db=0`. QUEUE_CONN_STR = "addrs=127.0.0.1:6379 db=0" diff --git a/docs/content/doc/advanced/config-cheat-sheet.en-us.md b/docs/content/doc/advanced/config-cheat-sheet.en-us.md index 3bee84562a19..040aed5eb918 100644 --- a/docs/content/doc/advanced/config-cheat-sheet.en-us.md +++ b/docs/content/doc/advanced/config-cheat-sheet.en-us.md @@ -173,7 +173,7 @@ Values containing `#` or `;` must be quoted using `` ` `` or `"""`. - `LOG_SQL`: **true**: Log the executed SQL. - `DB_RETRIES`: **10**: How many ORM init / DB connect attempts allowed. - `DB_RETRY_BACKOFF`: **3s**: time.Duration to wait before trying another ORM init / DB connect attempt, if failure occured. -- `MAX_IDLE_CONNS` **2 or 0**: Max idle database connections on connnection pool, default is 2 (except on MySQL where it 0) +- `MAX_IDLE_CONNS` **2**: Max idle database connections on connnection pool, default is 2 - `CONN_MAX_LIFETIME` **0 or 3s**: Database connection max lifetime - default is 0, meaning there is no limit (except on MySQL where it is 3s) - `MAX_OPEN_CONNS` **0**: Database maximum open connections - default is 0, meaning there is no limit. diff --git a/modules/setting/database.go b/modules/setting/database.go index 4ca2dfb45198..bb0d39c088e7 100644 --- a/modules/setting/database.go +++ b/modules/setting/database.go @@ -47,9 +47,6 @@ var ( IterateBufferSize int }{ Timeout: 500, - MaxIdleConns: 2, - ConnMaxLifetime: 15 * time.Minute, - MaxOpenConns: 0, } ) From 18086527d88f3c45ce8304a7edbaff3168a121e6 Mon Sep 17 00:00:00 2001 From: zeripath Date: Wed, 16 Oct 2019 07:19:37 +0100 Subject: [PATCH 03/11] Update modules/setting/database.go --- modules/setting/database.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/setting/database.go b/modules/setting/database.go index bb0d39c088e7..9dd2594fa3a2 100644 --- a/modules/setting/database.go +++ b/modules/setting/database.go @@ -80,7 +80,7 @@ func InitDBConfig() { Database.Path = sec.Key("PATH").MustString(filepath.Join(AppDataPath, "gitea.db")) Database.Timeout = sec.Key("SQLITE_TIMEOUT").MustInt(500) if Database.UseMySQL { - Database.MaxIdleConns = sec.Key("MAX_IDLE_CONNS").MustInt(0) + Database.MaxIdleConns = sec.Key("MAX_IDLE_CONNS").MustInt(2) Database.ConnMaxLifetime = sec.Key("CONN_MAX_LIFE_TIME").MustDuration(3 * time.Second) } else { Database.MaxIdleConns = sec.Key("MAX_IDLE_CONNS").MustInt(2) From 57d98a3567a2797f46b7ddd081febd2d39f40504 Mon Sep 17 00:00:00 2001 From: Andrew Thornton Date: Wed, 16 Oct 2019 09:06:31 +0100 Subject: [PATCH 04/11] Update go fmt --- modules/setting/database.go | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/modules/setting/database.go b/modules/setting/database.go index 9dd2594fa3a2..8c49ba3c5a17 100644 --- a/modules/setting/database.go +++ b/modules/setting/database.go @@ -46,7 +46,7 @@ var ( ConnMaxLifetime time.Duration IterateBufferSize int }{ - Timeout: 500, + Timeout: 500, } ) @@ -79,11 +79,10 @@ func InitDBConfig() { Database.Charset = sec.Key("CHARSET").In("utf8", []string{"utf8", "utf8mb4"}) Database.Path = sec.Key("PATH").MustString(filepath.Join(AppDataPath, "gitea.db")) Database.Timeout = sec.Key("SQLITE_TIMEOUT").MustInt(500) + Database.MaxIdleConns = sec.Key("MAX_IDLE_CONNS").MustInt(2) if Database.UseMySQL { - Database.MaxIdleConns = sec.Key("MAX_IDLE_CONNS").MustInt(2) Database.ConnMaxLifetime = sec.Key("CONN_MAX_LIFE_TIME").MustDuration(3 * time.Second) } else { - Database.MaxIdleConns = sec.Key("MAX_IDLE_CONNS").MustInt(2) Database.ConnMaxLifetime = sec.Key("CONN_MAX_LIFE_TIME").MustDuration(0) } Database.MaxOpenConns = sec.Key("MAX_OPEN_CONNS").MustInt(0) From 3d849ff92ba7252e2cc81347d6ca42e8600db03f Mon Sep 17 00:00:00 2001 From: zeripath Date: Wed, 16 Oct 2019 21:38:31 +0100 Subject: [PATCH 05/11] Update docs/content/doc/advanced/config-cheat-sheet.en-us.md --- docs/content/doc/advanced/config-cheat-sheet.en-us.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/content/doc/advanced/config-cheat-sheet.en-us.md b/docs/content/doc/advanced/config-cheat-sheet.en-us.md index 9bea778308d9..93d487bea8cb 100644 --- a/docs/content/doc/advanced/config-cheat-sheet.en-us.md +++ b/docs/content/doc/advanced/config-cheat-sheet.en-us.md @@ -174,7 +174,7 @@ Values containing `#` or `;` must be quoted using `` ` `` or `"""`. - `DB_RETRIES`: **10**: How many ORM init / DB connect attempts allowed. - `DB_RETRY_BACKOFF`: **3s**: time.Duration to wait before trying another ORM init / DB connect attempt, if failure occured. - `MAX_IDLE_CONNS` **2**: Max idle database connections on connnection pool, default is 2 -- `CONN_MAX_LIFETIME` **0 or 3s**: Database connection max lifetime - default is 0, meaning there is no limit (except on MySQL where it is 3s) +- `CONN_MAX_LIFETIME` **0 or 3s**: Sets the maximum amount of time a DB connection may be reused - default is 0, meaning there is no limit (except on MySQL where it is 3s) - `MAX_OPEN_CONNS` **0**: Database maximum open connections - default is 0, meaning there is no limit. ## Indexer (`indexer`) From baa17bc36ff2d7d048b23cad8a60e4fa5af3c2fe Mon Sep 17 00:00:00 2001 From: zeripath Date: Wed, 16 Oct 2019 21:41:09 +0100 Subject: [PATCH 06/11] Apply suggestions from code review --- custom/conf/app.ini.sample | 2 +- docs/content/doc/advanced/config-cheat-sheet.en-us.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/custom/conf/app.ini.sample b/custom/conf/app.ini.sample index 24b4133eba77..26f49cb7a7df 100644 --- a/custom/conf/app.ini.sample +++ b/custom/conf/app.ini.sample @@ -288,7 +288,7 @@ DB_RETRIES = 10 DB_RETRY_BACKOFF = 3s ; Max idle database connections on connnection pool, default is 2 MAX_IDLE_CONNS = 2 -; Database connection max life time, default is 0 or 3s mysql +; Database connection max life time, default is 0 or 3s mysql (See #6804 & #7071 for reasoning) CONN_MAX_LIFETIME = 3s ; Database maximum number of open connections, default is 0 meaning no maximum MAX_OPEN_CONNS = 0 diff --git a/docs/content/doc/advanced/config-cheat-sheet.en-us.md b/docs/content/doc/advanced/config-cheat-sheet.en-us.md index 93d487bea8cb..970316fd23b8 100644 --- a/docs/content/doc/advanced/config-cheat-sheet.en-us.md +++ b/docs/content/doc/advanced/config-cheat-sheet.en-us.md @@ -174,7 +174,7 @@ Values containing `#` or `;` must be quoted using `` ` `` or `"""`. - `DB_RETRIES`: **10**: How many ORM init / DB connect attempts allowed. - `DB_RETRY_BACKOFF`: **3s**: time.Duration to wait before trying another ORM init / DB connect attempt, if failure occured. - `MAX_IDLE_CONNS` **2**: Max idle database connections on connnection pool, default is 2 -- `CONN_MAX_LIFETIME` **0 or 3s**: Sets the maximum amount of time a DB connection may be reused - default is 0, meaning there is no limit (except on MySQL where it is 3s) +- `CONN_MAX_LIFETIME` **0 or 3s**: Sets the maximum amount of time a DB connection may be reused - default is 0, meaning there is no limit (except on MySQL where it is 3s - see #6804 & #7071) - `MAX_OPEN_CONNS` **0**: Database maximum open connections - default is 0, meaning there is no limit. ## Indexer (`indexer`) From db0c53508ac25004d8146ecd177f71326df68740 Mon Sep 17 00:00:00 2001 From: Andrew Thornton Date: Fri, 18 Oct 2019 16:54:35 +0100 Subject: [PATCH 07/11] Move the order of setting around --- models/models.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/models/models.go b/models/models.go index 8dbe485d86b0..b963dec17eb7 100644 --- a/models/models.go +++ b/models/models.go @@ -157,9 +157,9 @@ func SetEngine() (err error) { // so use log file to instead print to stdout. x.SetLogger(NewXORMLogger(setting.Database.LogSQL)) x.ShowSQL(setting.Database.LogSQL) + x.SetMaxOpenConns(setting.Database.MaxOpenConns) x.SetMaxIdleConns(setting.Database.MaxIdleConns) x.SetConnMaxLifetime(setting.Database.ConnMaxLifetime) - x.SetMaxOpenConns(setting.Database.MaxOpenConns) return nil } From 156966db0b67d153ed572c7d2b9f8af6e80f6b37 Mon Sep 17 00:00:00 2001 From: Andrew Thornton Date: Mon, 21 Oct 2019 17:26:21 +0100 Subject: [PATCH 08/11] Add note about port exhaustion --- docs/content/doc/advanced/config-cheat-sheet.en-us.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/content/doc/advanced/config-cheat-sheet.en-us.md b/docs/content/doc/advanced/config-cheat-sheet.en-us.md index 8c445678ef20..d766712ebb1f 100644 --- a/docs/content/doc/advanced/config-cheat-sheet.en-us.md +++ b/docs/content/doc/advanced/config-cheat-sheet.en-us.md @@ -192,9 +192,9 @@ Values containing `#` or `;` must be quoted using `` ` `` or `"""`. - `LOG_SQL`: **true**: Log the executed SQL. - `DB_RETRIES`: **10**: How many ORM init / DB connect attempts allowed. - `DB_RETRY_BACKOFF`: **3s**: time.Duration to wait before trying another ORM init / DB connect attempt, if failure occured. -- `MAX_IDLE_CONNS` **2**: Max idle database connections on connnection pool, default is 2 -- `CONN_MAX_LIFETIME` **0 or 3s**: Sets the maximum amount of time a DB connection may be reused - default is 0, meaning there is no limit (except on MySQL where it is 3s - see #6804 & #7071) - `MAX_OPEN_CONNS` **0**: Database maximum open connections - default is 0, meaning there is no limit. +- `MAX_IDLE_CONNS` **2**: Max idle database connections on connnection pool, default is 2 - this will be capped to `MAX_OPEN_CONNS`. +- `CONN_MAX_LIFETIME` **0 or 3s**: Sets the maximum amount of time a DB connection may be reused - default is 0, meaning there is no limit (except on MySQL where it is 3s - see #6804 & #7071). Please see #8273 for further discussion of these defaults regarding port exhaustion. ## Indexer (`indexer`) From edabc2f9365ee039135c4492360d745c58b13724 Mon Sep 17 00:00:00 2001 From: zeripath Date: Mon, 21 Oct 2019 17:28:28 +0100 Subject: [PATCH 09/11] Update docs/content/doc/advanced/config-cheat-sheet.en-us.md --- docs/content/doc/advanced/config-cheat-sheet.en-us.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/content/doc/advanced/config-cheat-sheet.en-us.md b/docs/content/doc/advanced/config-cheat-sheet.en-us.md index d766712ebb1f..c9da6f2a4ded 100644 --- a/docs/content/doc/advanced/config-cheat-sheet.en-us.md +++ b/docs/content/doc/advanced/config-cheat-sheet.en-us.md @@ -194,7 +194,7 @@ Values containing `#` or `;` must be quoted using `` ` `` or `"""`. - `DB_RETRY_BACKOFF`: **3s**: time.Duration to wait before trying another ORM init / DB connect attempt, if failure occured. - `MAX_OPEN_CONNS` **0**: Database maximum open connections - default is 0, meaning there is no limit. - `MAX_IDLE_CONNS` **2**: Max idle database connections on connnection pool, default is 2 - this will be capped to `MAX_OPEN_CONNS`. -- `CONN_MAX_LIFETIME` **0 or 3s**: Sets the maximum amount of time a DB connection may be reused - default is 0, meaning there is no limit (except on MySQL where it is 3s - see #6804 & #7071). Please see #8273 for further discussion of these defaults regarding port exhaustion. +- `CONN_MAX_LIFETIME` **0 or 3s**: Sets the maximum amount of time a DB connection may be reused - default is 0, meaning there is no limit (except on MySQL where it is 3s - see #6804 & #7071). Please see #8273 for further discussion of these values regarding port exhaustion. ## Indexer (`indexer`) From 5788827991f736c3a4e2a5d01fbe49f2757766ed Mon Sep 17 00:00:00 2001 From: zeripath Date: Mon, 21 Oct 2019 17:32:42 +0100 Subject: [PATCH 10/11] Update docs/content/doc/advanced/config-cheat-sheet.en-us.md --- docs/content/doc/advanced/config-cheat-sheet.en-us.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/content/doc/advanced/config-cheat-sheet.en-us.md b/docs/content/doc/advanced/config-cheat-sheet.en-us.md index c9da6f2a4ded..642bdb081382 100644 --- a/docs/content/doc/advanced/config-cheat-sheet.en-us.md +++ b/docs/content/doc/advanced/config-cheat-sheet.en-us.md @@ -194,7 +194,7 @@ Values containing `#` or `;` must be quoted using `` ` `` or `"""`. - `DB_RETRY_BACKOFF`: **3s**: time.Duration to wait before trying another ORM init / DB connect attempt, if failure occured. - `MAX_OPEN_CONNS` **0**: Database maximum open connections - default is 0, meaning there is no limit. - `MAX_IDLE_CONNS` **2**: Max idle database connections on connnection pool, default is 2 - this will be capped to `MAX_OPEN_CONNS`. -- `CONN_MAX_LIFETIME` **0 or 3s**: Sets the maximum amount of time a DB connection may be reused - default is 0, meaning there is no limit (except on MySQL where it is 3s - see #6804 & #7071). Please see #8273 for further discussion of these values regarding port exhaustion. +- `CONN_MAX_LIFETIME` **0 or 3s**: Sets the maximum amount of time a DB connection may be reused - default is 0, meaning there is no limit (except on MySQL where it is 3s - see #6804 & #7071). Please see #8540 & #8273 for further discussion of these values regarding port exhaustion. ## Indexer (`indexer`) From eeeb5971c4f5e1d6d39d2949166f17fb66cfb98f Mon Sep 17 00:00:00 2001 From: Andrew Thornton Date: Mon, 21 Oct 2019 21:03:11 +0100 Subject: [PATCH 11/11] Slight reword --- docs/content/doc/advanced/config-cheat-sheet.en-us.md | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/docs/content/doc/advanced/config-cheat-sheet.en-us.md b/docs/content/doc/advanced/config-cheat-sheet.en-us.md index 642bdb081382..f99e9f661aeb 100644 --- a/docs/content/doc/advanced/config-cheat-sheet.en-us.md +++ b/docs/content/doc/advanced/config-cheat-sheet.en-us.md @@ -194,7 +194,10 @@ Values containing `#` or `;` must be quoted using `` ` `` or `"""`. - `DB_RETRY_BACKOFF`: **3s**: time.Duration to wait before trying another ORM init / DB connect attempt, if failure occured. - `MAX_OPEN_CONNS` **0**: Database maximum open connections - default is 0, meaning there is no limit. - `MAX_IDLE_CONNS` **2**: Max idle database connections on connnection pool, default is 2 - this will be capped to `MAX_OPEN_CONNS`. -- `CONN_MAX_LIFETIME` **0 or 3s**: Sets the maximum amount of time a DB connection may be reused - default is 0, meaning there is no limit (except on MySQL where it is 3s - see #6804 & #7071). Please see #8540 & #8273 for further discussion of these values regarding port exhaustion. +- `CONN_MAX_LIFETIME` **0 or 3s**: Sets the maximum amount of time a DB connection may be reused - default is 0, meaning there is no limit (except on MySQL where it is 3s - see #6804 & #7071). + +Please see #8540 & #8273 for further discussion of the appropriate values for `MAX_OPEN_CONNS`, `MAX_IDLE_CONNS` & `CONN_MAX_LIFETIME` and their +relation to port exhaustion. ## Indexer (`indexer`)