Increase Pool Size or Reduce Transaction Scope?
27.5K reputation · 06 Mar 2021, 02:50 UTC
Diagnosing Intermittent Exhaustion
The goal is to pinpoint why a Hibernate application using HikariCP intermittently runs out of connections during peak load. The core uncertainty lies in whether the culprit is a short‑lived pool size or lingering long transactions that keep connections open.
Key constraints include the interplay of connectionTimeout versus maximumPoolSize, the eviction logic of idleTimeout and maxLifetime, and the server‑side wait_timeout that may silently close idle sockets.
To resolve the behavior, consider the following questions:
- Should the pool be enlarged or should transaction boundaries be tightened to free connections earlier?
- What combination of
idleTimeoutandmaxLifetimeprevents temporary gaps in available connections during heavy load? - Which HikariCP and database metrics best correlate with the observed intermittent timeouts?