Uploaded image for project: 'ModeShape'
  1. ModeShape
  2. MODE-2674

Add the ability to configure the minIdle property for HikariCP

    Details

    • Type: Enhancement
    • Status: Resolved (View Workflow)
    • Priority: Major
    • Resolution: Done
    • Affects Version/s: 5.3.0.Final
    • Fix Version/s: 5.4.0.Final
    • Component/s: Storage
    • Labels:
      None
    • Environment:

      Non-Wildfly server which uses HikariCP for connection pool management.

      Description

      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:

      persistence": {
      "type" : "db",
      "connectionUrl": "jdbc:postgresql://server:5432/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!

        Gliffy Diagrams

          Attachments

            Activity

              People

              • Assignee:
                hchiorean Horia Chiorean
                Reporter:
                mohideen Mohamed Abdul Rasheed
              • Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: