Skip to main content

Database Connection Pool Sizer

Enter your infrastructure details to calculate the optimal min and max connection pool size for your database. Get ready-to-use config snippets for Prisma, Drizzle, SQLAlchemy, and Sequelize. Runs entirely in your browser.

✓ HikariCP formula ✓ Total connections across all instances ✓ Prisma / Drizzle / SQLAlchemy / Sequelize ✓ Over-limit warnings

Frequently Asked Questions

What is the pool_size formula used here?▼

The tool uses the HikariCP formula popularised by the article 'About Pool Sizing': pool_size = (core_count × 2) + effective_spindle_count. For SSDs, effective_spindle_count = 1. This formula is a starting point — workloads with very long queries or high I/O wait may need more connections, while CPU-bound workloads need fewer.

Why does adding more connections not always help?▼

Each database connection consumes memory on both the application server and the database server (PostgreSQL uses ~5–10 MB per backend process). Beyond a certain point, more connections cause context-switching overhead and lock contention that slows everything down. The formula is designed to keep the database busy without overwhelming it.

What is the difference between pool min and max?▼

The min pool size is the number of connections kept open at idle — keeping some warm connections avoids connection establishment latency on request spikes. The max pool size is the hard ceiling — requests that arrive when all connections are busy wait in a queue (with a timeout). Setting min = max (fixed pool) is common in high-traffic production environments to avoid connection churn.

How does the number of application instances affect the total?▼

Each application instance maintains its own connection pool independently. If you have 3 instances each with a max pool of 10, your database receives up to 30 simultaneous connections. Always compute total_connections = max_pool × instances and verify this is below your database's max_connections setting.

What is PostgreSQL's max_connections limit?▼

PostgreSQL defaults to max_connections = 100 (some managed providers set 500 or more). Exceeding this causes new connection attempts to fail with 'too many connections'. For high-concurrency workloads, use PgBouncer or pgpool-II as a connection proxy — your app connects to PgBouncer, which maintains a smaller number of real connections to PostgreSQL.

Should I use a connection pool for Redis?▼

Redis is single-threaded and processes commands sequentially, so a large pool does not parallelise Redis operations. A small pool (5–20) is usually sufficient. For Cluster mode, maintain a separate pool per shard. Redis clients like ioredis and redis-py handle pooling automatically.

Share this tool: X / Twitter LinkedIn
✓ 60,000+ developers use DevPlaybook ★★★★★ 4.8 / 5 on Gumroad ✓ MIT licensed · Instant download ✓ No login required

Related Products

on Gumroad

You Might Also Need

More Free Tools

Enjoying this tool? Get more like it.

Weekly developer tool guides, productivity playbooks & AI tricks. Free. No spam.

DevPlaybook Pro 7 days free

Unlock AI-Powered Dev Tools

  • ⚡ AI Code Review, Doc Generator & SQL Builder
  • ⚡ All premium templates & early access
  • ⚡ Member discounts on Gumroad products
Start Free Trial →

$9/mo after trial · Cancel anytime

Want the full toolkit?

Get DevPlaybook Pro

Every template, guide, boilerplate, and automation script in one bundle. 13 premium products — grab them all at once and save big.

$79
$241 separately Save $162 (67% off)
Get DevPlaybook Pro — $79 →

MIT licensed · Instant download · No subscription

See what's included → Browse all deals →