diff options
| author | Hana Kim <hyangah@gmail.com> | 2026-02-23 15:38:50 -0500 |
|---|---|---|
| committer | Hyang-Ah Hana Kim <hyangah@gmail.com> | 2026-02-23 17:14:17 -0800 |
| commit | 1c7acd4bf511b868c084297235f6f38db2264b21 (patch) | |
| tree | dc8ab29b005727a6e79f8d37f56f01839b1d72fb /internal/queue/gcpqueue/queue.go | |
| parent | f4bdadf886f3b016bb399240f9337d35eb29e5f0 (diff) | |
| download | go-x-pkgsite-1c7acd4bf511b868c084297235f6f38db2264b21.tar.xz | |
internal/database: set db connection pool limits
Under high-load, the frontend can issue many queries and trigger many
connections. This can exceed the Cloud SQL connection limit of 100 per
instance enforced by the Cloud Run environment, even if the database
itself has remaining global capacity.
To prevent this, we introduce limits on the database connection pool.
We also include settings for idle connections and connection lifetimes
to ensure better resource management and connection rotation.
Introduces new env vars:
GO_DISCOVERY_DATABASE_MAX_OPEN_CONNS
GO_DISCOVERY_DATABASE_MAX_IDLE_CONNS
GO_DISCOVERY_DATABASE_CONN_MAX_LIFETIME
GO_DISCOVERY_DATABASE_CONN_MAX_IDLE_TIME
Updates SetPoolSettings to validate that MaxIdleConns does not exceed
MaxOpenConns, providing a warning if it does and capping it.
Change-Id: I74edac05c4a23102d64e74a180c661c223e1b757
Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/747620
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Jonathan Amsterdam <jba@google.com>
Reviewed-by: Nicholas Husin <nsh@golang.org>
Reviewed-by: Nicholas Husin <husin@google.com>
kokoro-CI: kokoro <noreply+kokoro@google.com>
Diffstat (limited to 'internal/queue/gcpqueue/queue.go')
0 files changed, 0 insertions, 0 deletions
