-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Open
Description
META: External Connection Pooling and Custom Pool Integration
There are several related issues about using external connection poolers (like PgBouncer, RDS Proxy, etc.) or custom connection pools instead of Knex's built-in tarn.js pooling. This META issue tracks all of them.
The Core Problems:
- No way to disable Knex's internal pooling - Users want to use external poolers like PgBouncer, AWS RDS Proxy, or cloud-managed connection pooling, but Knex always creates its own pool
- Cannot pass pre-existing pools - Users want to share connection pools between Knex and other libraries (like express-mysql-session) but have no way to pass an existing pool to Knex
- Cannot access Knex's pool - Users want to access the underlying pool instance for monitoring, sharing with other libraries, or custom management
Use Cases:
- Cloud environments: Using managed connection poolers (AWS RDS Proxy, Azure Database connection pooling, Google Cloud SQL connection pooling)
- PgBouncer: Transaction-mode pooling for better connection efficiency across multiple application instances
- Multi-app coordination: Sharing a single connection pool between Knex and other libraries (session stores, job queues, etc.)
- Stateless connections: AWS Data API and similar services where connections are handled externally
- Pool observability: Monitoring pool metrics, implementing custom health checks, debugging connection issues
Related Open Issues:
- How to disable knex connection pooling? #5159 - How to disable knex connection pooling?
- Use custom MySQL2 connection pool into Knex - getting stucked #6092 - Use custom MySQL2 connection pool into Knex - getting stucked
- Request: Way to specify pre-existing mysql connection pool #1824 - Request: Way to specify pre-existing mysql connection pool
- How to access connection pool database instances? #5720 - How to access connection pool database instances?
Related Closed Issues (for context):
- PgBouncer transaction pooling vs. Knex pooling? #3069 - PgBouncer transaction pooling vs. Knex pooling?
This meta issue tracks progress on supporting these external pooling scenarios.