Advertisement
Latency = service time + queueing time. Optimal pool ≈ cores × 2 for most OLTP.
What you're seeing
Little's Law: throughput = concurrency / latency. Too few connections: requests queue, latency spikes. Too many: each connection costs CPU (context switches), memory (per-conn state), and contention. The DB likes 2-4× cores, not hundreds.
HikariCP author Brett Wooldridge: "More is not better." Use pgBouncer in front for many app servers.
★ KEY TAKEAWAY
Too few connections: queueing. Too many: thrashing. Optimal ≈ 2-4× cores. 'More is not better.'
▶ WHAT TO TRY
- Slide Pool size and watch the latency curve.
- Notice the minimum around 20 — that's the sweet spot for this workload.