← Back to Node.js performance mappg
🐘
Node.js Performance
Postgres Pool Sizing
Size DB pools per Node process without exhausting Postgres.
Detailed Description
Every Node process can create its own database pool. If you run many pods or cluster workers, total connections can multiply quickly and overwhelm Postgres.
Calculate pool size from the database connection budget. Consider pgbouncer for many short-lived app connections, and always monitor waiting clients and connection errors.
Mental Model
pods * workers * poolMax <= database connection budget
When To Use
- ->Running many Node pods or cluster workers
- ->Seeing connection exhaustion
- ->Tuning API concurrency safely
Tools: pg Pool, RDS max_connections, pgbouncer
pg-pool.js
Live Editor
Loading...
Output
Run code to see output...