Context
Serverless functions (webhook handlers, auth callbacks, scheduled jobs) create a new database connection on each invocation, exhausting connection limits during traffic spikes.
Current Limitation/Problem
During traffic spikes, serverless functions open 100+ simultaneous database connections, hitting the 200-connection limit and causing connection refused errors.
Expected Outcome
Database connection multiplexing via PgBouncer (or RDS Proxy), with transaction-level pooling and automatic scaling for serverless workloads.
Acceptance Criteria
Technical Scope
- infra/terraform/ - PgBouncer or RDS Proxy resource provisioning
- backend/shared/db/ - serverless connection pool adapter
- backend/serverless/ - Lambda function database configuration
- docker-compose.yml - local PgBouncer service for development
- backend/monitoring/ - connection pool metrics and leak detection
Context
Serverless functions (webhook handlers, auth callbacks, scheduled jobs) create a new database connection on each invocation, exhausting connection limits during traffic spikes.
Current Limitation/Problem
During traffic spikes, serverless functions open 100+ simultaneous database connections, hitting the 200-connection limit and causing connection refused errors.
Expected Outcome
Database connection multiplexing via PgBouncer (or RDS Proxy), with transaction-level pooling and automatic scaling for serverless workloads.
Acceptance Criteria
Technical Scope