commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Phil Steitz <>
Subject [pool] [dbcp] Re: evictor destroying connections below minIdle?
Date Sat, 18 Oct 2014 15:45:58 GMT
On 10/17/14 5:38 PM, Anthony Biacco wrote:
> I just started running pool 2.2 alongside dbcp 2.0.1 in tomcat 7 against
> mysql.
> I noticed a situation while running the idle evictor where there's a time
> during eviction where the number of connections drops below the value set
> for minIdle, so in theory if all connections were idle for
> minEvictableIdleTimeMillis, i could have no free connections.
> After the eviction, connections seem to be created back up to minIdle.
> I expected it to only evict down to the minIdle value, not evict all
> eligible idle connections and then recreate up to minIdle.
> The way i'm viewing the number of connections is through mysql's "show full
> processlist" command.
> Is what i'm describing possible or am I missing something?

Yes, this is possible.  When evicting idle instances due to
minEvictableIdleTimeMillis exceeded, the evictor does not take into
account the number of idle instances remaining in the pool and it
performs the evict, ensure min idle actions in sequence.  If you
want to avoid the destroy / recreate scenario, you can use
softMinEvictableIdleTimeMillis instead.  
> If it is possible, couldn't this cause the resource to become unavailable
> in the time between destruction and recreation?

I am not sure what you mean here.  This could lead to the idle
instance count hitting zero, but client threads will still get
served as long as maxTotal is not exceeded.  Client threads will
create instances to serve requests when the pool is empty, as long
as there is capacity to do so, and evictor destroy actions
immediately create capacity.  Borrowers may have to incur makeObject
(create physical connection in DBCP case) latency, but they will get


> Here's my config:
>                 initialSize="15"
>                 minIdle="15"
>                 maxIdle="100"
>                 maxTotal="200"
>                 maxWaitMillis="4000"
>                 defaultQueryTimeout="20"
>                 testOnBorrow="true"
>                 testWhileIdle="true"
>                 blockWhenExhausted="true"
>                 numTestsPerEvictionRun="50"
>                 timeBetweenEvictionRunsMillis="120000"
>                 minEvictableIdleTimeMillis="119000"
>                 validationQuery="SELECT 1"
>                 validationQueryTimeout="2"
>                 removeAbandoned="true"
>                 removeAbandonedOnBorrow="true"
>                 removeAbandonedTimeout="60"
>                 logAbandoned="true"
> Thanks,
> -Tony

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message