What causes intermittent HikariCP connection pool exhaustion under peak load?
0 reputation · 03 Jan 2025, 14:22 UTC
Connection Pool Exhaustion Under Peak Load
Spring Boot applications using HikariCP can experience intermittent connection pool exhaustion during peak traffic periods. The default maximumPoolSize of 10 connections may be insufficient when concurrent requests spike, causing the pool to deplete faster than connections are returned.
During load testing, the application logs show 'Connection is not available' messages, and monitoring reveals activeConnections reaching maximumPoolSize while idle connections remain low. The 30-second connectionTimeout then triggers cascading failures as requests queue and eventually fail.
Key constraints include HikariCP's version-specific defaults (3.x in Spring Boot 2.x vs 5.x in 3.x), database-side connection limits that may silently cap availability, and the challenge of reproducing intermittent behavior in non-production environments. The pool's connection reclamation mechanisms may also be insufficient under sustained high load.
Which metrics most reliably indicate impending pool exhaustion, and how should maximumPoolSize be tuned given the interaction between application-level pool settings and database connection limits?