Database pool sizing from connection hold time
A service starts 450 database operations per second. Requests hold a connection for 40 ms at p95, and 32 connections are available to this service.
Jump to resultsInputs
Results
Runs in your browser- In flight at p95 duration
- 18requests
- Pool utilization at p95
- 56.25%
- Original traffic at saturation
- 800req/s
The p95 scenario is within the target. Check burst behavior and the p99 duration case.
| Effective arrival rate | 450 req/s |
|---|---|
| In flight at p50 duration | 5.4 requests |
| In flight at p99 duration | 42.75 requests |
| Slots at 65% target | 28 slots |
| Unused p95 pool share | 43.75 % |
| Illustrative queue multiplier | 2.286 × |
What to try
The p95 case uses about 56% of the pool. Increase p95 while keeping the traffic fixed to model a release that holds transactions open longer.
How the estimate works
In-flight requests L = arrival rate λ × time in system W
The effective arrival rate includes retries. The three concurrency values are separate what-if calculations that use p50, p95, and p99 as fixed durations. Little’s Law itself connects steady-state averages, so these estimates have no concurrency percentile guarantee.
Pool utilization uses the p95 planning duration. The saturation ceiling is the original request rate that would keep every slot occupied at that fixed duration. Slots needed at a target utilization are rounded up.
The curve is a normalized M/M/1 illustration, 1 ÷ (1 − utilization). Real multi-worker queues, burstiness, and load-dependent latency can shift the knee. The curve clamps the vertical scale at 10× for readability.
Frequently asked questions
Should waiting for a PostgreSQL connection count as connection hold time?
Start timing once a connection is allocated and stop when it is released. Track acquisition waiting separately to see when the pool is already congested.
Why can a larger database pool lower query throughput?
More concurrent queries can compete for locks, CPU, and disk. Test the database while raising slots and watch for rising execution time.