The HikariCP has the minIdle configuration which decides the number of idle connections that remain open even after the idle timeout has expired. When not configured, the minIdle is set to the maximumPoolSize value. (See: https://github.com/brettwooldridge/HikariCP/blob/dev/src/main/java/com/zaxxer/hikari/HikariConfig.java#L911)
Currently, Modeshape does not configure the minIdle property for the HikariDataSource. Therefore, HikariCP is not closing any of the idle database connections. In our case, we have configured the maximumPoolSize as 50, so out database server always has 50 idle connections to Modeshape application.
My forum post: https://developer.jboss.org/message/966772#966772
Modeshape 5 open database connections
I have noticed that the database connection threads in the postgres server are never closed. They are in an idle state when there is no active usage. We use Modeshape 5.1.0.Final (Fcrepo 4.7.0) and postgres 9.5.
Here is our persistence configuration:
"type" : "db",
"driver" : "org.postgresql.Driver",
"username" : "username",
"password" : "password",
"poolSize" : 20
The number of open threads is based on the poolSize configuration. When we had 50 as the poolSize we had 50 idle postgres threads and when we lowered it to 20, the idle threads came down to 20. I just want to check if this is how the database connection is supposed to work or if the connections are supposed to be closed after a period of no activity. Also, what would be the recommended value for the poolSize paramater?
Thanks in advance!