Java.HikariCP.Does pool always keep minimum idle connections, and all connections above are closed after idleTime ?

Does the pool always keep minimumIdle connections, and are connections above minimumIdle closed after idleTimeout?

Answer:
Yes — that’s exactly how it works:

🔹 HikariCP’s idle connection management works like this:

  • The pool tries to maintain at least minimumIdle connections — even if they sit idle for longer than idleTimeout, they’re not closed as long as the total number of idle connections ≤ minimumIdle.
  • Any idle connections above minimumIdle are considered “excess idle connections.” If they stay unused longer than idleTimeout, they will be closed by the pool.

🔹 What this means practically:

  • If your pool has minimumIdle=5, the pool will keep at least 5 idle connections alive indefinitely (or until demand increases).
  • If demand causes the pool to grow beyond minimumIdle (e.g., up to maximumPoolSize=20), and then traffic drops off, the extra connections over minimumIdle will start closing after idleTimeout passes without activity.

Key point:

  • minimumIdle sets the baseline of idle connections always kept alive.
  • idleTimeout controls how long extra idle connections (beyond minimumIdle) can sit unused before being closed.
This entry was posted in Без рубрики. Bookmark the permalink.