You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by John Cherouvim <jc...@eworx.gr> on 2006/03/08 13:16:53 UTC

JNDI datasource question

Hello

I have a JNDI Datasource pooling 10 connections on a database of my 
mysql server. Why does it use only one process on the mysql server? I 
have set max active to 10 connections and I am accessing the application 
from different IPs at the same time. I then perform a SHOW PROCESSLIST 
on mysql and I only see one process related to the datasource. On the 
other hand, applications which access the database directly or using 
programmatic connection polling use many processes as expected.

Could someone explain me if this is the case and why does it happen?

Thanks

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


Re: JNDI datasource question

Posted by Andre Van Klaveren <ny...@gmail.com>.
The initialSize parameter is specific to DBCP.  I believe the
interface in Tomcat only has fields that are common among pooling
implementations (Commons Pool).  You'll have to manually edit the pool
configuration.

An idle connection is one that is in the pool that is not currently
being used by the application.



On 3/8/06, John Cherouvim <jc...@eworx.gr> wrote:
> Thanks for your detailed explanation.
>
> In tomcat 5.0.28 I cannot find initialSize parameter. Is it something
> that was added later?
> And by idle connection, do we mean the connection that was closed in a
> finally block (returned to the pool)?
>
> John
>
>
> Tim Lucia wrote:
>
> >The number of connections is affected by three parameters:
> >
> >    initialSize="10"
> >    maxIdle="20"
> >    maxActive="50"
> >also:
> >    maxWait="5000"
> >
> >initialSize="10" says make 10 connections at startup.  SHOW PROCESSLIST will
> >reveal 10 processes in this case.
> >
> >maxIdle="20" says close any idle connections in excess of 20.  SHOW
> >PROCESSLIST will reveal 20 or fewer idle processes in this case.
> >
> >maxActive="50" says to cut off incoming connections at 50.  Any connection
> >attempt beyond 50 will wait for maxWait="5000" (5 seconds) for a free
> >connection before giving up.
> >
> >Tim
> >
> >
> >-----Original Message-----
> >From: John Cherouvim [mailto:jc@eworx.gr]
> >Sent: Wednesday, March 08, 2006 7:17 AM
> >To: users@tomcat.apache.org
> >Subject: JNDI datasource question
> >
> >Hello
> >
> >I have a JNDI Datasource pooling 10 connections on a database of my
> >mysql server. Why does it use only one process on the mysql server? I
> >have set max active to 10 connections and I am accessing the application
> >from different IPs at the same time. I then perform a SHOW PROCESSLIST
> >on mysql and I only see one process related to the datasource. On the
> >other hand, applications which access the database directly or using
> >programmatic connection polling use many processes as expected.
> >
> >Could someone explain me if this is the case and why does it happen?
> >
> >Thanks
> >
> >---------------------------------------------------------------------
> >To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> >For additional commands, e-mail: users-help@tomcat.apache.org
> >
> >
> >
> >---------------------------------------------------------------------
> >To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> >For additional commands, e-mail: users-help@tomcat.apache.org
> >
> >
> >
> >
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>
>


--
Virtually,
Andre Van Klaveren
Architect III, SCP
Global Public Sector
Unisys Corporation

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


RE: JNDI datasource question

Posted by Tim Lucia <ti...@yahoo.com>.
connection.close() on a pooled connection is returned to the pool, i.e.,
idled.  Unless doing so would exceed maxIdle, in which case it would be
really closed.

I can't say for sure when it was added, but I can say I've used it with
5.0.28, whether or not it was documented.  It's just a port / repackaging of
Commons DBCP, and that has had initialSize for a long time now.

Tim

-----Original Message-----
From: John Cherouvim [mailto:jc@eworx.gr] 
Sent: Wednesday, March 08, 2006 7:52 AM
To: Tomcat Users List
Subject: Re: JNDI datasource question

Thanks for your detailed explanation.

In tomcat 5.0.28 I cannot find initialSize parameter. Is it something that
was added later?
And by idle connection, do we mean the connection that was closed in a
finally block (returned to the pool)?

John


Tim Lucia wrote:

>The number of connections is affected by three parameters:
>
>    initialSize="10"
>    maxIdle="20"
>    maxActive="50"
>also:
>    maxWait="5000"
>
>initialSize="10" says make 10 connections at startup.  SHOW PROCESSLIST 
>will reveal 10 processes in this case.
>
>maxIdle="20" says close any idle connections in excess of 20.  SHOW 
>PROCESSLIST will reveal 20 or fewer idle processes in this case.
>
>maxActive="50" says to cut off incoming connections at 50.  Any 
>connection attempt beyond 50 will wait for maxWait="5000" (5 seconds) 
>for a free connection before giving up.
>
>Tim
>
>
>-----Original Message-----
>From: John Cherouvim [mailto:jc@eworx.gr]
>Sent: Wednesday, March 08, 2006 7:17 AM
>To: users@tomcat.apache.org
>Subject: JNDI datasource question
>
>Hello
>
>I have a JNDI Datasource pooling 10 connections on a database of my 
>mysql server. Why does it use only one process on the mysql server? I 
>have set max active to 10 connections and I am accessing the 
>application from different IPs at the same time. I then perform a SHOW 
>PROCESSLIST on mysql and I only see one process related to the 
>datasource. On the other hand, applications which access the database 
>directly or using programmatic connection polling use many processes as
expected.
>
>Could someone explain me if this is the case and why does it happen?
>
>Thanks
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
>For additional commands, e-mail: users-help@tomcat.apache.org
>
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
>For additional commands, e-mail: users-help@tomcat.apache.org
>
>
>  
>


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



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


Re: JNDI datasource question

Posted by John Cherouvim <jc...@eworx.gr>.
Thanks for your detailed explanation.

In tomcat 5.0.28 I cannot find initialSize parameter. Is it something 
that was added later?
And by idle connection, do we mean the connection that was closed in a 
finally block (returned to the pool)?

John


Tim Lucia wrote:

>The number of connections is affected by three parameters:
>
>    initialSize="10"
>    maxIdle="20"
>    maxActive="50"
>also:
>    maxWait="5000"
>
>initialSize="10" says make 10 connections at startup.  SHOW PROCESSLIST will
>reveal 10 processes in this case.
>
>maxIdle="20" says close any idle connections in excess of 20.  SHOW
>PROCESSLIST will reveal 20 or fewer idle processes in this case.
>
>maxActive="50" says to cut off incoming connections at 50.  Any connection
>attempt beyond 50 will wait for maxWait="5000" (5 seconds) for a free
>connection before giving up.
>
>Tim
>
>
>-----Original Message-----
>From: John Cherouvim [mailto:jc@eworx.gr] 
>Sent: Wednesday, March 08, 2006 7:17 AM
>To: users@tomcat.apache.org
>Subject: JNDI datasource question
>
>Hello
>
>I have a JNDI Datasource pooling 10 connections on a database of my 
>mysql server. Why does it use only one process on the mysql server? I 
>have set max active to 10 connections and I am accessing the application 
>from different IPs at the same time. I then perform a SHOW PROCESSLIST 
>on mysql and I only see one process related to the datasource. On the 
>other hand, applications which access the database directly or using 
>programmatic connection polling use many processes as expected.
>
>Could someone explain me if this is the case and why does it happen?
>
>Thanks
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
>For additional commands, e-mail: users-help@tomcat.apache.org
>
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
>For additional commands, e-mail: users-help@tomcat.apache.org
>
>
>  
>


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


RE: JNDI datasource question

Posted by Tim Lucia <ti...@yahoo.com>.
The number of connections is affected by three parameters:

    initialSize="10"
    maxIdle="20"
    maxActive="50"
also:
    maxWait="5000"

initialSize="10" says make 10 connections at startup.  SHOW PROCESSLIST will
reveal 10 processes in this case.

maxIdle="20" says close any idle connections in excess of 20.  SHOW
PROCESSLIST will reveal 20 or fewer idle processes in this case.

maxActive="50" says to cut off incoming connections at 50.  Any connection
attempt beyond 50 will wait for maxWait="5000" (5 seconds) for a free
connection before giving up.

Tim


-----Original Message-----
From: John Cherouvim [mailto:jc@eworx.gr] 
Sent: Wednesday, March 08, 2006 7:17 AM
To: users@tomcat.apache.org
Subject: JNDI datasource question

Hello

I have a JNDI Datasource pooling 10 connections on a database of my 
mysql server. Why does it use only one process on the mysql server? I 
have set max active to 10 connections and I am accessing the application 
from different IPs at the same time. I then perform a SHOW PROCESSLIST 
on mysql and I only see one process related to the datasource. On the 
other hand, applications which access the database directly or using 
programmatic connection polling use many processes as expected.

Could someone explain me if this is the case and why does it happen?

Thanks

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



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