Introduces PgBouncer as a connection pooler between the API service and PostgreSQL in docker-compose.prod.yml, reducing connection overhead and improving concurrency under production load. - Add PgBouncer service (edoburu/pgbouncer:1.23.1-p2) with transaction pool mode, max_client_conn=200, default_pool_size=20 - Route API DATABASE_URL through PgBouncer (port 6432), keep direct connection (DATABASE_URL_DIRECT) for Prisma migrations/introspection - Create infra/pgbouncer/ config: pgbouncer.ini, userlist template, and entrypoint script with runtime env-var substitution - Update prisma.config.ts to prefer DATABASE_URL_DIRECT for migrations - Add K6 load test (e2e/load/pgbouncer-pool-test.js) with ramp-up to 200 VUs, pool exhaustion detection, and p95 < 2s threshold - Add PgBouncer env vars to .env.example Co-Authored-By: Paperclip <noreply@paperclip.ing>
13 lines
591 B
Plaintext
13 lines
591 B
Plaintext
;; =============================================================================
|
|
;; PgBouncer userlist — injected at container startup
|
|
;;
|
|
;; This is a TEMPLATE file. The entrypoint script substitutes environment
|
|
;; variables to produce the real /etc/pgbouncer/userlist.txt at runtime.
|
|
;;
|
|
;; Format: "username" "password"
|
|
;; Passwords can be plaintext, md5, or scram-sha-256 hashed.
|
|
;; =============================================================================
|
|
"${DB_USER}" "${DB_PASSWORD}"
|
|
"pgbouncer_admin" "${PGBOUNCER_ADMIN_PASSWORD}"
|
|
"pgbouncer_stats" "${PGBOUNCER_STATS_PASSWORD}"
|