Does use-strict-min permit closure of idle connections dropping the pool below min-pool-size?

Solution Verified - Updated

Environment

  • Red Hat JBoss Enterprise Application Platform (EAP)
    • 5
    • 6
    • 7
    • 8

Issue

  • When using <use-strict-min>true</use-strict-min>, can idle connection closure drop the pool size below <min-pool-size>?

Resolution

When use-strict-min is set to true, the idle connection scan will not mark for closure any further connections once the min-pool-size has been reached.

In JBoss EAP 8, the two parameters <use-strict-min>true</use-strict-min> and <prefill>true</prefill> have almost the same effect. When <use-strict-min>true</use-strict-min> is used in combination with <prefill>true</prefill>, there is a behavior that can only be achieved with use-strict-min. Specifically, when idle connections are closed based on idle-timeout-minutes, connections will not be closed below min-pool-size, even if some connections in the pool have already exceeded the idle-timeout-minutes threshold. For example:

  • When min-pool-size > 0, prefill=false, and use-strict-min=false, min-pool-size is effectively ignored, and the pool eventually shrinks to zero if there is no access to the datasource.

  • When min-pool-size > 0, prefill=true, and use-strict-min=false, if all connections in the pool are detected as long idle, the pool size is first reduced to zero and then prefilled up to min-pool-size. In other words, min-pool-size acts as the target number of connections to prefill.

  • When min-pool-size > 0, prefill=true, and use-strict-min=true, during the idle connection cleanup process triggered by idle-timeout-minutes, the pool does not allow the number of connections to temporarily drop below min-pool-size. Even if the connections are old, they are not closed, and the number of connections specified by min-pool-size is always kept in the pool. In the JBoss EAP 8 datasource implementation, connections are handed out in Last-In-First-Out (LIFO) order, meaning the most recently returned connection is issued first. Due to this connection allocation order and the behavior of use-strict-min=true, a side effect may occur where older connections corresponding to min-pool-size remain in the pool and are never closed by idle-timeout-minutes.

Components
Category

This solution is part of Red Hat’s fast-track publication program, providing a huge library of solutions that Red Hat engineers have created while supporting our customers. To give you the knowledge you need the instant it becomes available, these articles may be presented in a raw and unedited form.