mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2026-07-18 23:47:50 +00:00
config: Lower default [database].MAX_OPEN_CONNS (#10821)
Resolves https://codeberg.org/forgejo/forgejo/issues/10584 Codeberg mostly uses about 30 connections with rare peaks, so I think it's safe to assume that this value is reasonable even for large Forgejo deployments, and only needs to be adjusted for very busy instances. In practice, the open connections likely remain lower due to the connection lifetime and maximum idle connections (which could maybe also be tuned later). A value of 30 would technically allow 3 full-loaded Forgejo instances to operate on one PostgreSQL instance (30 * 3 = 90 < 97) without conflicting. Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/10821 Reviewed-by: Michael Kriese <michael.kriese@gmx.de> Co-authored-by: Otto Richter <git@otto.splvs.net> Co-committed-by: Otto Richter <git@otto.splvs.net>
This commit is contained in:
parent
a8a12241ce
commit
5c8da92a6d
2 changed files with 3 additions and 3 deletions
|
|
@ -417,8 +417,8 @@ DB_TYPE = sqlite3
|
|||
;; Database connection max idle time, 0 prevents closing due to idle time.
|
||||
;CONN_MAX_IDLETIME = 0
|
||||
;;
|
||||
;; Database maximum number of open connections, default is 100 which is the lowest default from Postgres (MariaDB + MySQL default to 151). Ensure you only increase the value if you configured your database server accordingly.
|
||||
;MAX_OPEN_CONNS = 100
|
||||
;; Database maximum number of open connections. Ensure you only increase the value if your database server is configured to handle the amount of open connections accordingly.
|
||||
;MAX_OPEN_CONNS = 30
|
||||
;;
|
||||
;; Whether execute database models migrations automatically
|
||||
;AUTO_MIGRATION = true
|
||||
|
|
|
|||
|
|
@ -96,7 +96,7 @@ func loadDBSetting(rootCfg ConfigProvider) {
|
|||
Database.ConnMaxLifetime = sec.Key("CONN_MAX_LIFETIME").MustDuration(0)
|
||||
}
|
||||
Database.ConnMaxIdleTime = sec.Key("CONN_MAX_IDLETIME").MustDuration(0)
|
||||
Database.MaxOpenConns = sec.Key("MAX_OPEN_CONNS").MustInt(100)
|
||||
Database.MaxOpenConns = sec.Key("MAX_OPEN_CONNS").MustInt(30)
|
||||
|
||||
Database.IterateBufferSize = sec.Key("ITERATE_BUFFER_SIZE").MustInt(50)
|
||||
Database.LogSQL = sec.Key("LOG_SQL").MustBool(false)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue