> On 2/1/18 6:08 PM, Pawel Veselov wrote:
>> On Thu, Feb 1, 2018 at 1:02 PM, Mark Thomas <ma...@apache.org>
>> wrote:
>>> On 01/02/18 20:57, Pawel Veselov wrote:
>>>> Hello.
>>>>
>>>> It looks like in tomcat 8 (looking at master's HEAD), the
>>>> minIdle support is broken. According to docs, minIdle supposed
>>>> to do : "The minimum number of established connections that
>>>> should be kept in the pool at all times. The connection pool
>>>> can shrink below this number if validation queries fail."
>>>>
>>>> I see that pool cleaner thread checks if the minIdle is *less*
>>>> than pool size, and only then invokes checkIdle(). checkIdle()
>>>> then will remove(!) connections from idle pool until the value
>>>> drops down to minIdle. But I don't see any code that will add
>>>> connections when minIdle is not met, and the documentation
>>>> suggests that that's the intent.
>>>>
>>>> Am I misunderstanding something? Is there a way to keep a level
>>>> of connections in the pool? I don't want to have initialSize
>>>> control that, as I need to at 0, to prevent failures during
>>>> pool initialization...
>>> But that is what initial size is for.
>>
>> Indisputably so. However, that would be the only other way to
>> achieve this, as long as the database connection don't die.
>
> What is the problem with failures during pool initialization?

ConnectionPool.init() attempts to borrow initialSize worth of
connections. Imagine your database server is having problems at this
time. This will make init() fail, and the pool creation fail, and your
webapp is dead in the water after that, it's unlikely that there are
mechanisms to attempt to recreate the connection pool. This
complicates automatic recovery. An existing pool can recover easily,
once the database is back online after a failure, the connections will
be vended normally.

> If you
> don't want the pool to make initialSize connections when it starts,
> when DO you want the pool to create those connections? During the
> first "cleaning"?

I don't have strong expectations on exactly when the pool is to be
inflated. minIdle suggests that it should happen at some point, may be
that can be "cleaning", though this thread should probably then be
renamed as "maintenance". If not inflated in time, then any requested
connection will populate the pool, that's already what ends up going
on in my case.

In all cases, I think that either minIdle should be reimplemented, or
at least the documentation should be changed from saying "The minimum
number of established connections that should be kept in the pool at
all times" to "Minimum idle connections that will remain in the pool
after cleaning", with a note that idle connections are not created by
the pool itself to fulfill that amount.

The reason prefer the pool to auto-saturate, is that so sudden demand
for high amount of database connections doesn't require a lot of new
connections to be established, as that's the slowest part of the
process.

Thank you,
  Pawel.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org

Reply via email to