18.5. Idle Connections

You can configure connections to be closed when they are idle. For example; if you just had a peak period and now want to reap the unused ones. This is done via the idle-timeout-minutes parameter.
Idle checking is done on a separate Idle Remover thread on an 'least recently used' (LRU) basis.
Idle connections (connections that have been unused for the period defined by idle-timeout-minutes) are purged regularly. The check is performed at an interval that is half of the idle-timeout-minutes value.
The pool itself operates on an 'most recently used' (MRU) basis. This allows the excess connections to be easily identified.
Should closing idle connections cause the pool to fall below the min-pool-size value, new connections are created.

Note

If you have long-running transactions and you use interleaving (i.e. do not track-connection-by-tx) make sure the idle timeout is greater than the transaction timeout. When interleaving the connection is returned to the pool for others to use. If however nobody does use it, it would be a candidate for removal before the transaction is committed.