mirror of
https://github.com/coder/coder.git
synced 2026-09-24 15:04:27 +08:00
feat: make database connection pool size configurable (#21403)
Closes https://github.com/coder/coder/issues/21360 A few considerations/notes: - I've kept the number of conns to 10 in all other places, except coderd - which uses the config value - I opted to also make idle conns configurable; the greater the delta between max open and max idle, the more connection churn - Postgres maintains a [_process_ per connection](https://www.postgresql.org/docs/current/connect-estab.html), contrary to what the comment said previously - Operators should be able to tune this, since process churn can negatively affect OS scheduling - I've set the value to `"auto"` by default so it's not another knob one _has to_ twiddle, and sets max idle = max conns / 3 --------- Signed-off-by: Danny Kopping <danny@coder.com>
This commit is contained in:
Generated
+2
@@ -433,6 +433,8 @@ curl -X GET http://coder-server:8080/api/v2/deployment/config \
|
||||
"username_field": "string"
|
||||
},
|
||||
"pg_auth": "string",
|
||||
"pg_conn_max_idle": "string",
|
||||
"pg_conn_max_open": 0,
|
||||
"pg_connection_url": "string",
|
||||
"pprof": {
|
||||
"address": {
|
||||
|
||||
Generated
+6
@@ -2893,6 +2893,8 @@ CreateWorkspaceRequest provides options for creating a new workspace. Only one o
|
||||
"username_field": "string"
|
||||
},
|
||||
"pg_auth": "string",
|
||||
"pg_conn_max_idle": "string",
|
||||
"pg_conn_max_open": 0,
|
||||
"pg_connection_url": "string",
|
||||
"pprof": {
|
||||
"address": {
|
||||
@@ -3432,6 +3434,8 @@ CreateWorkspaceRequest provides options for creating a new workspace. Only one o
|
||||
"username_field": "string"
|
||||
},
|
||||
"pg_auth": "string",
|
||||
"pg_conn_max_idle": "string",
|
||||
"pg_conn_max_open": 0,
|
||||
"pg_connection_url": "string",
|
||||
"pprof": {
|
||||
"address": {
|
||||
@@ -3622,6 +3626,8 @@ CreateWorkspaceRequest provides options for creating a new workspace. Only one o
|
||||
| `oauth2` | [codersdk.OAuth2Config](#codersdkoauth2config) | false | | |
|
||||
| `oidc` | [codersdk.OIDCConfig](#codersdkoidcconfig) | false | | |
|
||||
| `pg_auth` | string | false | | |
|
||||
| `pg_conn_max_idle` | string | false | | |
|
||||
| `pg_conn_max_open` | integer | false | | |
|
||||
| `pg_connection_url` | string | false | | |
|
||||
| `pprof` | [codersdk.PprofConfig](#codersdkpprofconfig) | false | | |
|
||||
| `prometheus` | [codersdk.PrometheusConfig](#codersdkprometheusconfig) | false | | |
|
||||
|
||||
Generated
+22
@@ -1015,6 +1015,28 @@ URL of a PostgreSQL database. If empty, PostgreSQL binaries will be downloaded f
|
||||
|
||||
Type of auth to use when connecting to postgres. For AWS RDS, using IAM authentication (awsiamrds) is recommended.
|
||||
|
||||
### --postgres-conn-max-open
|
||||
|
||||
| | |
|
||||
|-------------|--------------------------------------|
|
||||
| Type | <code>int</code> |
|
||||
| Environment | <code>$CODER_PG_CONN_MAX_OPEN</code> |
|
||||
| YAML | <code>pgConnMaxOpen</code> |
|
||||
| Default | <code>10</code> |
|
||||
|
||||
Maximum number of open connections to the database. Defaults to 10.
|
||||
|
||||
### --postgres-conn-max-idle
|
||||
|
||||
| | |
|
||||
|-------------|--------------------------------------|
|
||||
| Type | <code>string</code> |
|
||||
| Environment | <code>$CODER_PG_CONN_MAX_IDLE</code> |
|
||||
| YAML | <code>pgConnMaxIdle</code> |
|
||||
| Default | <code>auto</code> |
|
||||
|
||||
Maximum number of idle connections to the database. Set to "auto" (the default) to use max open / 3. Value must be greater or equal to 0; 0 means explicitly no idle connections.
|
||||
|
||||
### --secure-auth-cookie
|
||||
|
||||
| | |
|
||||
|
||||
Reference in New Issue
Block a user