You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Niranjan Babu Bommu <ni...@gmail.com> on 2016/05/11 10:58:55 UTC

tomcat(7.0.56) is not releasing idle jdbc connections

Hi,

we are migrating prod servers to tomcat, since we are doing it slowly we
have found an issue in jdbc connection pool, tomcat is not releasing idle
jdbc connections, even we have tried setting maxIdle="10" but "NumIdle 97"
always. due to this threads are piling up in database.

I'm including my config here, can someone please help me out, how to
minimize idle jdbc connections.

<Resource name="jdbc/DS"
          auth="Container"
          type="javax.sql.DataSource"
          testWhileIdle="true"
          testOnBorrow="true"
          testOnReturn="false"
          fairQueue="false"
          validationQuery="SELECT 1"
          validationInterval="30000"
          timeBetweenEvictionRunsMillis="30000"
          maxActive="100"
          maxIdle="10"
          minIdle="10"
          maxWait="10000"
          initialSize="10"
          removeAbandonedTimeout="60"
          removeAbandoned="true"
          logAbandoned="true"
          minEvictableIdleTimeMillis="300000"
          jmxEnabled="true"

jdbcInterceptors="ConnectionState;StatementFinalizer;ResetAbandonedTimer"
          username="<user>"
          password="<password>"
          driverClassName="com.mysql.jdbc.Driver"

url="jdbc:mysql://<DBservername>/<schema>?useServerPrepStmts=false&amp;useOldAliasMetadataBehavior=true"/>


-- 
*Thanks*
*Niranjan*

Re: tomcat(7.0.56) is not releasing idle jdbc connections

Posted by Niranjan Babu Bommu <ni...@gmail.com>.
I'm re-posting my ds

<Resource name="jdbc/DS"
          auth="Container"
          type="javax.sql.DataSource"
          testWhileIdle="true"
          testOnBorrow="true"
          testOnReturn="false"
          fairQueue="false"
          validationQuery="SELECT 1"
          validationInterval="30000"
          timeBetweenEvictionRunsMillis="30000"
          maxActive="100"
          maxIdle="10"
          minIdle="10"
          maxWait="10000"
          initialSize="10"
          removeAbandonedTimeout="60"
          removeAbandoned="true"
          logAbandoned="true"
          minEvictableIdleTimeMillis="300000"
          jmxEnabled="true"

jdbcInterceptors="ConnectionState;StatementFinalizer;ResetAbandonedTimer"
          username="<user>"
          password="<password>"
          driverClassName="com.mysql.jdbc.Driver"

url="jdbc:mysql://<DBservername>/<schema>?useServerPrepStmts=false&amp;useOldAliasMetadataBehavior=true"/>

On Wed, May 11, 2016 at 10:16 AM, Niranjan Babu Bommu <
niranjan.bommu@gmail.com> wrote:

> I tried the same config on test stacks. numidle always "10" why it is
> behaving differently in prod?
>
> <Resource name="jdbc/DS"
>           auth="Container"
>           type="javax.sql.DataSource"
>           testWhileIdle="true"
>           testOnBorrow="true"
>           testOnReturn="false"
>           fairQueue="false"
>           validationQuery="SELECT 1"
>           validationInterval="30000"
>           timeBetweenEvictionRunsMillis="30000"
>           maxActive="100"
>           maxIdle="10"
>           minIdle="10"
>           maxWait="10000"
>           initialSize="10"
>           removeAbandonedTimeout="60"
>           removeAbandoned="true"
>           logAbandoned="true"
>           minEvictableIdleTimeMillis="300000"
>           jmxEnabled="true"
>
> jdbcInterceptors="ConnectionState;StatementFinalizer;ResetAbandonedTimer"
>           username="<user>"
>           password="<password>"
>           driverClassName="com.mysql.jdbc.Driver"
>
> url="jdbc:mysql://<DBservername>/<schema>?useServerPrepStmts=false&amp;useOldAliasMetadataBehavior=true"/>
>
> On Wed, May 11, 2016 at 7:35 AM, Niranjan Babu Bommu <
> niranjan.bommu@gmail.com> wrote:
>
>> Hi Mark
>> I have included defined data source in this mail, do you want me to
>> include complete server.xml?
>>
>> thanks
>> Niranjan
>>
>> On Wed, May 11, 2016 at 7:19 AM, Mark Thomas <ma...@apache.org> wrote:
>>
>>> On 11/05/2016 11:58, Niranjan Babu Bommu wrote:
>>> > Hi,
>>> >
>>> > we are migrating prod servers to tomcat, since we are doing it slowly
>>> we
>>> > have found an issue in jdbc connection pool, tomcat is not releasing
>>> idle
>>> > jdbc connections, even we have tried setting maxIdle="10" but "NumIdle
>>> 97"
>>> > always. due to this threads are piling up in database.
>>> >
>>> > I'm including my config here, can someone please help me out, how to
>>> > minimize idle jdbc connections.
>>>
>>> Where have you added the configuration below?
>>>
>>> Mark
>>>
>>>
>>> >
>>> > <Resource name="jdbc/DS"
>>> >           auth="Container"
>>> >           type="javax.sql.DataSource"
>>> >           testWhileIdle="true"
>>> >           testOnBorrow="true"
>>> >           testOnReturn="false"
>>> >           fairQueue="false"
>>> >           validationQuery="SELECT 1"
>>> >           validationInterval="30000"
>>> >           timeBetweenEvictionRunsMillis="30000"
>>> >           maxActive="100"
>>> >           maxIdle="10"
>>> >           minIdle="10"
>>> >           maxWait="10000"
>>> >           initialSize="10"
>>> >           removeAbandonedTimeout="60"
>>> >           removeAbandoned="true"
>>> >           logAbandoned="true"
>>> >           minEvictableIdleTimeMillis="300000"
>>> >           jmxEnabled="true"
>>> >
>>> >
>>> jdbcInterceptors="ConnectionState;StatementFinalizer;ResetAbandonedTimer"
>>> >           username="<user>"
>>> >           password="<password>"
>>> >           driverClassName="com.mysql.jdbc.Driver"
>>> >
>>> >
>>> url="jdbc:mysql://<DBservername>/<schema>?useServerPrepStmts=false&amp;useOldAliasMetadataBehavior=true"/>
>>> >
>>> >
>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
>>> For additional commands, e-mail: users-help@tomcat.apache.org
>>>
>>>
>>
>>
>> --
>> *Thanks*
>> *Niranjan*
>> *+1 781.956.6900 <%2B1%20781.956.6900>*
>>
>
>
>
> --
> *Thanks*
> *Niranjan*
> *+1 781.956.6900 <%2B1%20781.956.6900>*
>



-- 
*Thanks*
*Niranjan*
*+1 781.956.6900*

Re: tomcat(7.0.56) is not releasing idle jdbc connections

Posted by Igor Cicimov <ic...@gmail.com>.
On 12 May 2016 9:00 am, "Igor Cicimov" <ic...@gmail.com> wrote:
>
>
> On 12 May 2016 12:16 am, "Niranjan Babu Bommu" <ni...@gmail.com>
wrote:
> >
> > I tried the same config on test stacks. numidle always "10" why it is
> > behaving differently in prod?
> >
> Are you sure your testing db config is identical to the prod one?
>
> > <Resource name="jdbc/DS"
> >           auth="Container"
> >           type="javax.sql.DataSource"
> >           testWhileIdle="true"
> >           testOnBorrow="true"
> >           testOnReturn="false"
> >           fairQueue="false"
> >           validationQuery="SELECT 1"
> >           validationInterval="30000"
> >           timeBetweenEvictionRunsMillis="30000"
> >           maxActive="100"

Also according to your setup you can have up to 100 connections and since
this is a pool the connections will stay open and reused.

Regarding difference with test environment I assume it is simply because
you have different load ie much lower than prod hence less connections.

> >           maxIdle="10"
> >           minIdle="10"
> >           maxWait="10000"
> >           initialSize="10"
> >           removeAbandonedTimeout="60"
> >           removeAbandoned="true"
> >           logAbandoned="true"
> >           minEvictableIdleTimeMillis="300000"
> >           jmxEnabled="true"
> >
> >
jdbcInterceptors="ConnectionState;StatementFinalizer;ResetAbandonedTimer"
> >           username="<user>"
> >           password="<password>"
> >           driverClassName="com.mysql.jdbc.Driver"
> >
> >
url="jdbc:mysql://<DBservername>/<schema>?useServerPrepStmts=false&amp;useOldAliasMetadataBehavior=true"/>
> >
> > On Wed, May 11, 2016 at 7:35 AM, Niranjan Babu Bommu <
> > niranjan.bommu@gmail.com> wrote:
> >
> > > Hi Mark
> > > I have included defined data source in this mail, do you want me to
> > > include complete server.xml?
> > >
> > > thanks
> > > Niranjan
> > >
> > > On Wed, May 11, 2016 at 7:19 AM, Mark Thomas <ma...@apache.org> wrote:
> > >
> > >> On 11/05/2016 11:58, Niranjan Babu Bommu wrote:
> > >> > Hi,
> > >> >
> > >> > we are migrating prod servers to tomcat, since we are doing it
slowly we
> > >> > have found an issue in jdbc connection pool, tomcat is not
releasing
> > >> idle
> > >> > jdbc connections, even we have tried setting maxIdle="10" but
"NumIdle
> > >> 97"
> > >> > always. due to this threads are piling up in database.
> > >> >
> > >> > I'm including my config here, can someone please help me out, how
to
> > >> > minimize idle jdbc connections.
> > >>
> > >> Where have you added the configuration below?
> > >>
> > >> Mark
> > >>
> > >>
> > >> >
> > >> > <Resource name="jdbc/DS"
> > >> >           auth="Container"
> > >> >           type="javax.sql.DataSource"
> > >> >           testWhileIdle="true"
> > >> >           testOnBorrow="true"
> > >> >           testOnReturn="false"
> > >> >           fairQueue="false"
> > >> >           validationQuery="SELECT 1"
> > >> >           validationInterval="30000"
> > >> >           timeBetweenEvictionRunsMillis="30000"
> > >> >           maxActive="100"
> > >> >           maxIdle="10"
> > >> >           minIdle="10"
> > >> >           maxWait="10000"
> > >> >           initialSize="10"
> > >> >           removeAbandonedTimeout="60"
> > >> >           removeAbandoned="true"
> > >> >           logAbandoned="true"
> > >> >           minEvictableIdleTimeMillis="300000"
> > >> >           jmxEnabled="true"
> > >> >
> > >> >
> > >>
jdbcInterceptors="ConnectionState;StatementFinalizer;ResetAbandonedTimer"
> > >> >           username="<user>"
> > >> >           password="<password>"
> > >> >           driverClassName="com.mysql.jdbc.Driver"
> > >> >
> > >> >
> > >>
url="jdbc:mysql://<DBservername>/<schema>?useServerPrepStmts=false&amp;useOldAliasMetadataBehavior=true"/>
> > >> >
> > >> >
> > >>
> > >>
> > >> ---------------------------------------------------------------------
> > >> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> > >> For additional commands, e-mail: users-help@tomcat.apache.org
> > >>
> > >>
> > >
> > >
> > > --
> > > *Thanks*
> > > *Niranjan*
> > > *+1 781.956.6900 <%2B1%20781.956.6900>*
> > >
> >
> >
> >
> > --
> > *Thanks*
> > *Niranjan*
> > *+1 781.956.6900*

Re: tomcat(7.0.56) is not releasing idle jdbc connections

Posted by Igor Cicimov <ic...@gmail.com>.
On 12 May 2016 12:16 am, "Niranjan Babu Bommu" <ni...@gmail.com>
wrote:
>
> I tried the same config on test stacks. numidle always "10" why it is
> behaving differently in prod?
>
Are you sure your testing db config is identical to the prod one?

> <Resource name="jdbc/DS"
>           auth="Container"
>           type="javax.sql.DataSource"
>           testWhileIdle="true"
>           testOnBorrow="true"
>           testOnReturn="false"
>           fairQueue="false"
>           validationQuery="SELECT 1"
>           validationInterval="30000"
>           timeBetweenEvictionRunsMillis="30000"
>           maxActive="100"
>           maxIdle="10"
>           minIdle="10"
>           maxWait="10000"
>           initialSize="10"
>           removeAbandonedTimeout="60"
>           removeAbandoned="true"
>           logAbandoned="true"
>           minEvictableIdleTimeMillis="300000"
>           jmxEnabled="true"
>
> jdbcInterceptors="ConnectionState;StatementFinalizer;ResetAbandonedTimer"
>           username="<user>"
>           password="<password>"
>           driverClassName="com.mysql.jdbc.Driver"
>
>
url="jdbc:mysql://<DBservername>/<schema>?useServerPrepStmts=false&amp;useOldAliasMetadataBehavior=true"/>
>
> On Wed, May 11, 2016 at 7:35 AM, Niranjan Babu Bommu <
> niranjan.bommu@gmail.com> wrote:
>
> > Hi Mark
> > I have included defined data source in this mail, do you want me to
> > include complete server.xml?
> >
> > thanks
> > Niranjan
> >
> > On Wed, May 11, 2016 at 7:19 AM, Mark Thomas <ma...@apache.org> wrote:
> >
> >> On 11/05/2016 11:58, Niranjan Babu Bommu wrote:
> >> > Hi,
> >> >
> >> > we are migrating prod servers to tomcat, since we are doing it
slowly we
> >> > have found an issue in jdbc connection pool, tomcat is not releasing
> >> idle
> >> > jdbc connections, even we have tried setting maxIdle="10" but
"NumIdle
> >> 97"
> >> > always. due to this threads are piling up in database.
> >> >
> >> > I'm including my config here, can someone please help me out, how to
> >> > minimize idle jdbc connections.
> >>
> >> Where have you added the configuration below?
> >>
> >> Mark
> >>
> >>
> >> >
> >> > <Resource name="jdbc/DS"
> >> >           auth="Container"
> >> >           type="javax.sql.DataSource"
> >> >           testWhileIdle="true"
> >> >           testOnBorrow="true"
> >> >           testOnReturn="false"
> >> >           fairQueue="false"
> >> >           validationQuery="SELECT 1"
> >> >           validationInterval="30000"
> >> >           timeBetweenEvictionRunsMillis="30000"
> >> >           maxActive="100"
> >> >           maxIdle="10"
> >> >           minIdle="10"
> >> >           maxWait="10000"
> >> >           initialSize="10"
> >> >           removeAbandonedTimeout="60"
> >> >           removeAbandoned="true"
> >> >           logAbandoned="true"
> >> >           minEvictableIdleTimeMillis="300000"
> >> >           jmxEnabled="true"
> >> >
> >> >
> >>
jdbcInterceptors="ConnectionState;StatementFinalizer;ResetAbandonedTimer"
> >> >           username="<user>"
> >> >           password="<password>"
> >> >           driverClassName="com.mysql.jdbc.Driver"
> >> >
> >> >
> >>
url="jdbc:mysql://<DBservername>/<schema>?useServerPrepStmts=false&amp;useOldAliasMetadataBehavior=true"/>
> >> >
> >> >
> >>
> >>
> >> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> >> For additional commands, e-mail: users-help@tomcat.apache.org
> >>
> >>
> >
> >
> > --
> > *Thanks*
> > *Niranjan*
> > *+1 781.956.6900 <%2B1%20781.956.6900>*
> >
>
>
>
> --
> *Thanks*
> *Niranjan*
> *+1 781.956.6900*

Re: tomcat(7.0.56) is not releasing idle jdbc connections

Posted by Niranjan Babu Bommu <ni...@gmail.com>.
I tried the same config on test stacks. numidle always "10" why it is
behaving differently in prod?

<Resource name="jdbc/DS"
          auth="Container"
          type="javax.sql.DataSource"
          testWhileIdle="true"
          testOnBorrow="true"
          testOnReturn="false"
          fairQueue="false"
          validationQuery="SELECT 1"
          validationInterval="30000"
          timeBetweenEvictionRunsMillis="30000"
          maxActive="100"
          maxIdle="10"
          minIdle="10"
          maxWait="10000"
          initialSize="10"
          removeAbandonedTimeout="60"
          removeAbandoned="true"
          logAbandoned="true"
          minEvictableIdleTimeMillis="300000"
          jmxEnabled="true"

jdbcInterceptors="ConnectionState;StatementFinalizer;ResetAbandonedTimer"
          username="<user>"
          password="<password>"
          driverClassName="com.mysql.jdbc.Driver"

url="jdbc:mysql://<DBservername>/<schema>?useServerPrepStmts=false&amp;useOldAliasMetadataBehavior=true"/>

On Wed, May 11, 2016 at 7:35 AM, Niranjan Babu Bommu <
niranjan.bommu@gmail.com> wrote:

> Hi Mark
> I have included defined data source in this mail, do you want me to
> include complete server.xml?
>
> thanks
> Niranjan
>
> On Wed, May 11, 2016 at 7:19 AM, Mark Thomas <ma...@apache.org> wrote:
>
>> On 11/05/2016 11:58, Niranjan Babu Bommu wrote:
>> > Hi,
>> >
>> > we are migrating prod servers to tomcat, since we are doing it slowly we
>> > have found an issue in jdbc connection pool, tomcat is not releasing
>> idle
>> > jdbc connections, even we have tried setting maxIdle="10" but "NumIdle
>> 97"
>> > always. due to this threads are piling up in database.
>> >
>> > I'm including my config here, can someone please help me out, how to
>> > minimize idle jdbc connections.
>>
>> Where have you added the configuration below?
>>
>> Mark
>>
>>
>> >
>> > <Resource name="jdbc/DS"
>> >           auth="Container"
>> >           type="javax.sql.DataSource"
>> >           testWhileIdle="true"
>> >           testOnBorrow="true"
>> >           testOnReturn="false"
>> >           fairQueue="false"
>> >           validationQuery="SELECT 1"
>> >           validationInterval="30000"
>> >           timeBetweenEvictionRunsMillis="30000"
>> >           maxActive="100"
>> >           maxIdle="10"
>> >           minIdle="10"
>> >           maxWait="10000"
>> >           initialSize="10"
>> >           removeAbandonedTimeout="60"
>> >           removeAbandoned="true"
>> >           logAbandoned="true"
>> >           minEvictableIdleTimeMillis="300000"
>> >           jmxEnabled="true"
>> >
>> >
>> jdbcInterceptors="ConnectionState;StatementFinalizer;ResetAbandonedTimer"
>> >           username="<user>"
>> >           password="<password>"
>> >           driverClassName="com.mysql.jdbc.Driver"
>> >
>> >
>> url="jdbc:mysql://<DBservername>/<schema>?useServerPrepStmts=false&amp;useOldAliasMetadataBehavior=true"/>
>> >
>> >
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
>> For additional commands, e-mail: users-help@tomcat.apache.org
>>
>>
>
>
> --
> *Thanks*
> *Niranjan*
> *+1 781.956.6900 <%2B1%20781.956.6900>*
>



-- 
*Thanks*
*Niranjan*
*+1 781.956.6900*

Re: tomcat(7.0.56) is not releasing idle jdbc connections

Posted by Niranjan Babu Bommu <ni...@gmail.com>.
Hi Mark
I have included defined data source in this mail, do you want me to include
complete server.xml?

thanks
Niranjan

On Wed, May 11, 2016 at 7:19 AM, Mark Thomas <ma...@apache.org> wrote:

> On 11/05/2016 11:58, Niranjan Babu Bommu wrote:
> > Hi,
> >
> > we are migrating prod servers to tomcat, since we are doing it slowly we
> > have found an issue in jdbc connection pool, tomcat is not releasing idle
> > jdbc connections, even we have tried setting maxIdle="10" but "NumIdle
> 97"
> > always. due to this threads are piling up in database.
> >
> > I'm including my config here, can someone please help me out, how to
> > minimize idle jdbc connections.
>
> Where have you added the configuration below?
>
> Mark
>
>
> >
> > <Resource name="jdbc/DS"
> >           auth="Container"
> >           type="javax.sql.DataSource"
> >           testWhileIdle="true"
> >           testOnBorrow="true"
> >           testOnReturn="false"
> >           fairQueue="false"
> >           validationQuery="SELECT 1"
> >           validationInterval="30000"
> >           timeBetweenEvictionRunsMillis="30000"
> >           maxActive="100"
> >           maxIdle="10"
> >           minIdle="10"
> >           maxWait="10000"
> >           initialSize="10"
> >           removeAbandonedTimeout="60"
> >           removeAbandoned="true"
> >           logAbandoned="true"
> >           minEvictableIdleTimeMillis="300000"
> >           jmxEnabled="true"
> >
> > jdbcInterceptors="ConnectionState;StatementFinalizer;ResetAbandonedTimer"
> >           username="<user>"
> >           password="<password>"
> >           driverClassName="com.mysql.jdbc.Driver"
> >
> >
> url="jdbc:mysql://<DBservername>/<schema>?useServerPrepStmts=false&amp;useOldAliasMetadataBehavior=true"/>
> >
> >
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>
>


-- 
*Thanks*
*Niranjan*
*+1 781.956.6900*

Re: tomcat(7.0.56) is not releasing idle jdbc connections

Posted by Mark Thomas <ma...@apache.org>.
On 11/05/2016 11:58, Niranjan Babu Bommu wrote:
> Hi,
> 
> we are migrating prod servers to tomcat, since we are doing it slowly we
> have found an issue in jdbc connection pool, tomcat is not releasing idle
> jdbc connections, even we have tried setting maxIdle="10" but "NumIdle 97"
> always. due to this threads are piling up in database.
> 
> I'm including my config here, can someone please help me out, how to
> minimize idle jdbc connections.

Where have you added the configuration below?

Mark


> 
> <Resource name="jdbc/DS"
>           auth="Container"
>           type="javax.sql.DataSource"
>           testWhileIdle="true"
>           testOnBorrow="true"
>           testOnReturn="false"
>           fairQueue="false"
>           validationQuery="SELECT 1"
>           validationInterval="30000"
>           timeBetweenEvictionRunsMillis="30000"
>           maxActive="100"
>           maxIdle="10"
>           minIdle="10"
>           maxWait="10000"
>           initialSize="10"
>           removeAbandonedTimeout="60"
>           removeAbandoned="true"
>           logAbandoned="true"
>           minEvictableIdleTimeMillis="300000"
>           jmxEnabled="true"
> 
> jdbcInterceptors="ConnectionState;StatementFinalizer;ResetAbandonedTimer"
>           username="<user>"
>           password="<password>"
>           driverClassName="com.mysql.jdbc.Driver"
> 
> url="jdbc:mysql://<DBservername>/<schema>?useServerPrepStmts=false&amp;useOldAliasMetadataBehavior=true"/>
> 
> 


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