Imagine this scenario:
idleTimeout: 10 minutes
minimumIdle: 1
maximumPoolSize: 10
how I think things go:
under low load:
1 connection is created and used and returned. Maybe 2.
at peak start:
9 more connections will be created in a short time (bad).
The 10 connections will be in use, back to the pool, in use, back to the pool... all the time.
They will have no time to reach the "idleTimeout".
the peak ends, back to low load:
1 connection will be used and returned from time to time.
The 9 other will have chance to be discarded.
After a time, there will be only 1 or 2 connections as in the beginning.
What I don't get is, why is this worse than setting
minimumIdle: default=maximumPoolSize=10
as recommended by HikariCP?
I mean, the only bad thing I can see in the first scenario is that in the beginning of the peak, many connections need to be created in a sudden.
But the second scenario seems worse to me because I will have always all connections open even when I don't need them.
I can rewrite my question as:
Under heavy load, what is the real difference between a fixed size pool and a dynamic sized poll? Won't both use the same connections already opened?
---
Thanks for your time.