Reputation:
I have a spring boot, hibernate using java app. I deploy it on a jetty webserver with multiple instances. if I have too (greater than 10) many instances I get
com.zaxxer.hikari.pool.HikariPool$PoolInitializationException: Failed to initialize pool: FATAL: remaining connection slots are reserved for non-replication superuser connections
Many of the connections (10x instance) show up idle
ps:
postgres 9104 0.0 0.0 248968 4392 ? Ss 08:07 0:00 postgres: user my_db 127.0.0.1(60095) idle
Hikari trace log for an instance:
2017-02-21 10:59:47.578 DEBUG 7401 --- [l-1 housekeeper] com.zaxxer.hikari.pool.HikariPool : HikariPool-1 - Pool stats (total=10, active=0, idle=10, waiting=0)
setting
hikari.leakDetectionThreshold: 30000
Doesnt log anything interesing. I think this looks interesting HikariCP - connection is not available
Any ideas how i could debug this? Also I am on java 7, so hikari 2.4.7
Upvotes: 1
Views: 3840
Reputation: 36987
I think you must increase the max_connections parameter in your PostgreSQL configuration.
See https://wiki.postgresql.org/wiki/Tuning_Your_PostgreSQL_Server
You cannot allow the pool to keep more connections than your PostgreSQL installation allows.
Upvotes: 1