About this tool
A bigger database connection pool feels like free capacity — more connections, more parallel queries, fewer waits. In practice it is usually the opposite. Every open connection costs the database real resources: PostgreSQL forks a backend process per connection, MySQL dedicates a thread, and each one holds memory for work buffers, sort space and transaction state whether it is running a query or sitting idle in your pool. Worse, only a handful of queries can actually execute at once — one per CPU core, roughly — so when 300 connections all have work, 292 of them are not going faster, they are context-switching, fighting over locks and cache lines, and making the 8 that could run slower. The Demand tab works the other direction: Little's Law says the connections you actually need are just your query rate times your average query time, plus a peak factor for bursts.
The most cited sizing rule in the industry is the one from the HikariCP connection pool's wiki: connections = CPU cores × 2 + effective spindle count, where an SSD counts as one spindle. It comes out of an old PostgreSQL performance discussion, and people quote the formula while missing its actual argument — which is that the number is small. On an 8-core server the formula says 17 connections total, not 17 per service, because that is roughly how many queries the hardware can chew on at once; everything beyond that should queue in the pool, where waiting is cheap, instead of inside the database, where waiting is expensive. The HikariCP tab computes it, and the Wait tab shows what queueing does to latency as the pool fills: utilisation ρ = arrival rate × service time ÷ pool size stays harmless for a long stretch, develops a latency tail around 0.8, and at 1.0 the queue stops draining at all.
The fourth number is the one that causes the classic outage: max_connections. Your database has a hard limit — 100 by default on PostgreSQL, 151 on MySQL — and every service, worker, cron job and ops console shares it. Each team sizes its own pool for its own traffic and the arithmetic is never added up until the night it matters: five services with pools of 30 is 150 connections, the spike arrives, every pool fills at once, the database starts refusing logins, and all five services go down together even though each one was individually 'correctly' configured. The Server budget tab does that addition before the incident does it for you, including the few connections you should always reserve for migrations and for the human who has to log in and fix things.
The Summary tab chains the two halves — how many connections the workload needs, and how many the server can afford — into one recommended pool size and a plain-language verdict on whether the fleet fits inside the limit. Everything recalculates as you type and runs entirely in your browser: no data is sent anywhere, and nothing you enter is stored. The defaults are a worked example, so the page is never empty; replace them with your own QPS, query times and instance counts.
If you take one habit from this page, make it this: measure your average query time from the caller's side, network round trip included, and put that number into the Demand tab before touching any pool-size setting. Most pools in production are either 10× bigger than Little's Law justifies — wasting memory on both sides — or sized by copy-pasting a default from a tutorial. Two minutes with the real numbers replaces both with something you can defend in a design review.
How to use Connection Pool Size Calculator
- Demand: enter your target QPS, average query time in ms (measured from the caller, p50 is fine) and a peak factor for bursts; read the Little's Law connection count, the rounded-up value and the recommended pool with 10% headroom.
- HikariCP rule: enter the database server's CPU core count and effective disk count (an SSD counts as 1 spindle); read the cores×2+spindles pool size — remember it is a ceiling for the whole database, to be divided between services.
- Wait: enter the pool size, arrival rate in QPS and service time in ms; read the per-connection utilisation ρ = λS/c, the interpretation of where that sits on the queueing curve, and the pool sizes that would bring ρ back to 80% or 50%.
- Server budget & Summary: pick a max_connections preset (PostgreSQL 100 / MySQL 151 / custom), enter the number of services, the pool per service and the ops reserve; read the worst-case footprint against the limit with over-limit and low-reserve warnings — the Summary tab chains an independent set of inputs into one recommended pool and an over-limit verdict.
Frequently asked questions
How big should my connection pool be?
Start from Little's Law: connections = QPS × average query time in seconds, times a peak factor (1.5 is a reasonable default), rounded up with 10% headroom. For 1,000 QPS at 20 ms that is 33 connections — not 200. Cross-check against the HikariCP ceiling (cores × 2 + spindles, summed across all services on one database): if your demand number is larger than what the hardware can execute, the fix is faster queries or more database, not a bigger pool.
Why isn't a bigger pool always better?
Because connections are not free and parallelism is bounded. Each connection costs the database a process or thread plus per-connection memory (work_mem, sort buffers, transaction state) even while idle. And a server with 8 cores can only run about 8 queries at once — every connection beyond that is not extra throughput, it is extra context switching, lock contention and cache invalidation on the database side, which makes everything slower. A small pool that queues in the application, where waiting is cheap, consistently beats a large pool that queues inside the database, where waiting is expensive. Benchmarks behind the HikariCP wiki showed exactly this: throughput peaks at a small pool and degrades as the pool grows.
How do I spot a connection leak?
The signature is a pool that fills up and never drains: active connections climb monotonically over hours while QPS stays flat, until every checkout times out. Confirm it by comparing connections opened vs closed — pool metrics like HikariCP's active/idle counts, or pg_stat_activity on the database side, looking for a growing set of connections stuck 'idle in transaction' (the classic leak: code borrowed a connection, started a transaction and never returned it). Most pools can help directly: HikariCP's leakDetectionThreshold logs a stack trace for any connection held longer than the threshold, which usually points straight at the code path that forgot a close().
What should the connection wait timeout be?
Short — far shorter than intuition suggests, and shorter than the caller's own deadline. If your API promises a 2-second response, a request that waits 30 seconds for a connection has already failed; it just hasn't admitted it yet. A common starting point is a few seconds (HikariCP defaults to 30 s, which most teams lower to 2–5 s for user-facing paths). The timeout exists to fail fast when the pool is exhausted so load sheds instead of queueing unboundedly — pair it with an alert on wait-timeout occurrences, because even one means the pool or the database is undersized for the current load.
How high should max_connections be?
Only as high as the server's memory allows, and only as high as the summed application pools genuinely require. The per-connection cost is the constraint: PostgreSQL's default of 100 assumes roughly 5–10 MB of working memory per backend, so raising it to 1,000 on a small instance invites out-of-memory kills under load. The better direction is usually down, not up: size each service's pool with Little's Law, add them up with the Server budget tab, reserve a few connections for ops and migrations, and if the total still exceeds a sane limit, put a transaction-mode pooler like PgBouncer in front rather than raising the ceiling.
How do I split pools with read/write separation?
Treat each endpoint as its own budget: the primary handles writes plus the reads that must be strongly consistent, and each read replica gets its own pool sized from the read QPS and read latency via Little's Law — the Server budget tab applies per server, so run it once for the primary and once per replica. Two traps: replicas share the workload but not the limit, so a failover that moves all read traffic to fewer replicas must still fit within those replicas' max_connections; and reads routed to replicas go stale by replication lag, so keep a small pool to the primary for read-your-own-writes paths even if 95% of reads go elsewhere.
How do I verify a pool size with a load test?
Load-test against the real database, not a mock — pool sizing is a database question. Ramp to your target QPS with production-shaped queries and watch three numbers: pool wait time (time spent acquiring a connection), active connections, and database CPU. If wait time is near zero while active connections sit well below the pool size, the pool is bigger than needed; if wait time climbs and p99 latency bends upward, you are past ρ ≈ 0.8 — the Wait tab tells you which side of that bend you are on. Then run the failure drill: hold the load with a deliberately too-small pool and confirm you get clean timeouts and load shedding, not a database that falls over. Change one variable at a time, and re-test whenever the query mix changes.
Is my data uploaded anywhere?
No. Every calculation runs locally in your browser with JavaScript. Nothing you type — QPS figures, query times, pool sizes, connection limits — is transmitted, logged or stored.