You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In the sample config files provided for binary and docker installations, there's no configuration set for db.max_open and db.max_idle parameters.
Since these values are not set, they are by default passed as 0 when unmarshalled and configured here.
While having an unbounded connection is not desirable, it's not really that problematic but setting db.SetMaxIdleConns(0) means that every connection is established from scratch, thus not utilizing the connection pooling at all.
Here's the pg_stat_activity query results:
SELECT
COUNT(*),
state
FROM pg_stat_activity
WHERE datname = 'listmonk'
GROUP BY 2;
When max_idle isn't specified (0):
count | state
-------+--------
1 | active
When max_idle is specified (25):
count | state
-------+--------
1 | active
2 | idle
Proposed Fix
I think we can provide the following options as "sane defaults" in the sample configs.
max_open 25
max_idle 25
Unrelated
In addition to this, and although this is unrelated and not a bug, but we should also set db.SetConnMaxLifetime to something like 5-10 minutes.
The text was updated successfully, but these errors were encountered:
Makes sense. Can you send a PR? We just need this added to the sample config + db init. Default for older config after the next upgrade will be 0 automatically, so nothing changes.
Bug
In the sample config files provided for binary and docker installations, there's no configuration set for
db.max_open
anddb.max_idle
parameters.Since these values are not set, they are by default passed as
0
when unmarshalled and configured here.While having an unbounded connection is not desirable, it's not really that problematic but setting
db.SetMaxIdleConns(0)
means that every connection is established from scratch, thus not utilizing the connection pooling at all.Here's the
pg_stat_activity
query results:max_idle
isn't specified (0):max_idle
is specified (25):Proposed Fix
I think we can provide the following options as "sane defaults" in the sample configs.
Unrelated
In addition to this, and although this is unrelated and not a bug, but we should also set
db.SetConnMaxLifetime
to something like 5-10 minutes.The text was updated successfully, but these errors were encountered: