r/SpringBoot • u/fykup • Oct 13 '26
Discussion Spring Boot + HikariCP: 20 vs 2 idle PostgreSQL connections
I've been experimenting with HikariCP connection pool sizing in Spring Boot, particularly what happens to PostgreSQL connections after traffic stops.
One detail that's easy to miss: with Hikari's default sizing, minimumIdle and maximumPoolSize both resolve to 10. Since the idle target equals the maximum, idleTimeout has nothing to retire.
I ran two Spring Boot instances against PostgreSQL 16 on a 1 GiB VM, comparing three configurations:
- Default sizing: Both pools retained 10 connections each after traffic stopped.
- minimumIdle=1, retirement disabled: Pools still retained all 20 connections after growing under load.
- minimumIdle=1, retirement enabled: Connections dropped from 20 to 2, with approximately 29 MiB lower PostgreSQL cgroup memory.

There was a tradeoff. When traffic returned, median connection acquisition increased from under 3 ms to roughly 200 ms as the pools rebuilt capacity.
The experiment used a deliberately short 10-second idle timeout to make the behavior measurable, not as a production tuning recommendation.
Two repetitions, 2,280 successful workload requests, with recorded data and reproduction instructions.
Full write-up: https://pvrlabs.xyz/articles/spring-boot-jdbc-pool-reclaim.html
Curious how others configure HikariCP when multiple Spring Boot instances share a small PostgreSQL server. Do you generally keep the default fixed-size pools or allow idle connections to retire?
