From 782169da765baf1d651c1b71e5f974f762c92d8e Mon Sep 17 00:00:00 2001 From: tobi <31960611+tsmethurst@users.noreply.github.com> Date: Thu, 26 Jan 2023 15:12:48 +0100 Subject: [chore] set max open / idle conns + conn max lifetime for both postgres and sqlite (#1369) * [chore] set max open / idle conns + conn max lifetime for both postgres and sqlite * reduce cache size default to 8MiB, reduce connections to 2 * cpu * introduce max open conns multiplier, tune sqlite and pg separately * go fmt --- docs/configuration/database.md | 32 ++++++++++++++++++++++++++++---- 1 file changed, 28 insertions(+), 4 deletions(-) (limited to 'docs/configuration/database.md') diff --git a/docs/configuration/database.md b/docs/configuration/database.md index 38514e036..4fe8836fd 100644 --- a/docs/configuration/database.md +++ b/docs/configuration/database.md @@ -108,6 +108,30 @@ db-tls-mode: "disable" # Default: "" db-tls-ca-cert: "" +# Int. Number to multiply by CPU count to set permitted total of open database connections (in-use and idle). +# You can use this setting to tune your database connection behavior, though most admins won't need to touch it. +# +# Example values for multiplier 8: +# +# 1 cpu = 08 open connections +# 2 cpu = 16 open connections +# 4 cpu = 32 open connections +# +# Example values for multiplier 4: +# +# 1 cpu = 04 open connections +# 2 cpu = 08 open connections +# 4 cpu = 16 open connections +# +# A multiplier of 8 is a sensible default, but you may wish to increase this for instances +# running on very performant hardware, or decrease it for instances using v. slow CPUs. +# +# If you set this to 0 or less, it will be adjusted to 1. +# +# Examples: [16, 8, 10, 2] +# Default: 8 +db-max-open-conns-multiplier: 8 + # String. SQLite journaling mode. # SQLite only -- unused otherwise. # If set to empty string, the sqlite default will be used. @@ -126,11 +150,11 @@ db-sqlite-synchronous: "NORMAL" # Byte size. SQlite cache size. # SQLite only -- unused otherwise. -# If set to empty string or zero, the sqlite default will be used. +# If set to empty string or zero, the sqlite default (2MiB) will be used. # See: https://www.sqlite.org/pragma.html#pragma_cache_size -# Examples: ["32MiB", "0", "64MiB"] -# Default: "64MiB" -db-sqlite-cache-size: "64MiB" +# Examples: ["0", "2MiB", "8MiB", "64MiB"] +# Default: "8MiB" +db-sqlite-cache-size: "8MiB" # Duration. SQlite busy timeout. # SQLite only -- unused otherwise. -- cgit v1.2.3