-
Notifications
You must be signed in to change notification settings - Fork 335
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
adding postgres max idle connections configuration #2020
Conversation
Signed-off-by: nikita15p <nikita15p@gmail.com>
Signed-off-by: nikita15p <nikita15p@gmail.com>
Signed-off-by: nikita15p <nikita15p@gmail.com>
Signed-off-by: nikita15p <nikita15p@gmail.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks for the contribution! some minor things to fix and we can move forward with this
Signed-off-by: nikita15p <nikita15p@gmail.com>
@jakubdyszkiewicz Please review |
@@ -29,6 +29,9 @@ store: | |||
# Maximum number of open connections to the database | |||
# `0` value means number of open connections is unlimited | |||
maxOpenConnections: 0 # ENV: KUMA_STORE_POSTGRES_MAX_OPEN_CONNECTIONS | |||
# Maximum number of connections in the idle connection pool | |||
# <0 value means no idle connections and 0 means default max idle connections | |||
maxIdleConnections: 0 # ENV: KUMA_STORE_POSTGRES_MAX_IDLE_CONNECTIONS |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm looking at https://golang.org/src/database/sql/sql.go
. There are also following settings:
maxLifetime time.Duration // maximum amount of time a connection may be reused
maxIdleTime time.Duration // maximum amount of time a connection may be idle before being closed
That are default by zero and I'm looking at connectionCleanerRunLocked
implementation. Does it mean that once the connection is created it is never closed now?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, these values are 0 by default and the connections open/idle do not close by its age. If we have idle connections configured, it will use already open connections and will improve performance.
Summary
Currently maximum idle connections are not configurable for postgres db.
Full changelog
Issues resolved
Fix NA
Documentation
Reference: https://golang.org/src/database/sql/sql.go
Testing