You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@commons.apache.org by Peter Coppens <pc...@gmail.com> on 2006/12/31 15:12:09 UTC

DBCP connection takes (very) long

Hello,

Not sure this is the right forum to ask DBCP questions. If not I would
appreciate if someone could tell me where I should ask the question.

Anyway, I have DBCP 1.2.1 and Tomcat 6.02 configured with a mySql backend.

I have configured the pool through a jndi datasource,

	  <Resource name="jdbc/PurlDB" auth="Container" type="javax.sql.DataSource" 
		  factory="org.apache.commons.dbcp.BasicDataSourceFactory"
                  initialSize="200"
		  maxActive="200"
		  maxIdle="200"
		  maxWait="10000"
		  username="user"
		  password="***"
		  driverClassName="com.mysql.jdbc.Driver"
		  url="jdbc:mysql://192.168.36.134/purlie"
		  />

The code to get the connection just invokes getConnection on the Datasource
instance.


Everything works fine but when I start stress testing the tomcat servlet
app, some of the connections take a very long time (e.g. >5 minutes). I have
added logging to write out idle and active connections, and there always
seem to be lots of idle connections left.

Would anybody have any guidance as on how to identify and hopefully fix the
issue?

Thanks,

Peter
-- 
View this message in context: http://www.nabble.com/DBCP-connection-takes-%28very%29-long-tf2901748.html#a8107081
Sent from the Commons - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org


Re: DBCP connection takes (very) long

Posted by Peter Coppens <pc...@gmail.com>.
Christian,

I have not timed query execution, but then these queries are really very
simple and perform very well when Tomcat is not stress tested.  I am testing
tomcat with jMeter. 

I guess I can try to trim down the worker threads and see whether the
overall performance benefits from that. At this stage I have set the
#threads equal to the number of client threads but I can see that is not
necessarily optimal.

Thanks for your answer and suggestions!

Peter





Christian Hufgard wrote:
> 
> Hello Peter,
> 
> If the execution of the queries lasts a long time, this also might be
> cause of deadlocks. The fact that you have a lot of idle connections
> also indicates, that your application is not waiting for connections.
> 
> Have you tried logging execution time of each query?
> How do you test your application? Maybe you have to less tomcat
> workers so your requests are queued.
> 
> You could also test your application outside of tomcat to see, if
> there are any problems.
> 
> Christian
> 
> 
> 
> Sunday, December 31, 2006, 3:12:09 PM, you wrote:
> 
> 
>> Hello,
> 
>> Not sure this is the right forum to ask DBCP questions. If not I would
>> appreciate if someone could tell me where I should ask the question.
> 
>> Anyway, I have DBCP 1.2.1 and Tomcat 6.02 configured with a mySql
>> backend.
> 
>> I have configured the pool through a jndi datasource,
> 
>>           <Resource name="jdbc/PurlDB" auth="Container"
>> type="javax.sql.DataSource"
>>                  
>> factory="org.apache.commons.dbcp.BasicDataSourceFactory"
>>                   initialSize="200"
>>                   maxActive="200"
>>                   maxIdle="200"
>>                   maxWait="10000"
>>                   username="user"
>>                   password="***"
>>                   driverClassName="com.mysql.jdbc.Driver"
>>                   url="jdbc:mysql://192.168.36.134/purlie"
>>                   />
> 
>> The code to get the connection just invokes getConnection on the
>> Datasource
>> instance.
> 
> 
>> Everything works fine but when I start stress testing the tomcat servlet
>> app, some of the connections take a very long time (e.g. >5 minutes). I
>> have
>> added logging to write out idle and active connections, and there always
>> seem to be lots of idle connections left.
> 
>> Would anybody have any guidance as on how to identify and hopefully fix
>> the
>> issue?
> 
>> Thanks,
> 
>> Peter
> 
> 
> 
> -- 
> Best regards,
>  Christian                            mailto:christian.hufgard@gmx.de
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: commons-user-help@jakarta.apache.org
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/DBCP-connection-takes-%28very%29-long-tf2901748.html#a8107658
Sent from the Commons - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org


Re: DBCP connection takes (very) long

Posted by Christian Hufgard <ch...@gmx.de>.
Hello Peter,

If the execution of the queries lasts a long time, this also might be
cause of deadlocks. The fact that you have a lot of idle connections
also indicates, that your application is not waiting for connections.

Have you tried logging execution time of each query?
How do you test your application? Maybe you have to less tomcat
workers so your requests are queued.

You could also test your application outside of tomcat to see, if
there are any problems.

Christian



Sunday, December 31, 2006, 3:12:09 PM, you wrote:


> Hello,

> Not sure this is the right forum to ask DBCP questions. If not I would
> appreciate if someone could tell me where I should ask the question.

> Anyway, I have DBCP 1.2.1 and Tomcat 6.02 configured with a mySql backend.

> I have configured the pool through a jndi datasource,

>           <Resource name="jdbc/PurlDB" auth="Container" type="javax.sql.DataSource"
>                  
> factory="org.apache.commons.dbcp.BasicDataSourceFactory"
>                   initialSize="200"
>                   maxActive="200"
>                   maxIdle="200"
>                   maxWait="10000"
>                   username="user"
>                   password="***"
>                   driverClassName="com.mysql.jdbc.Driver"
>                   url="jdbc:mysql://192.168.36.134/purlie"
>                   />

> The code to get the connection just invokes getConnection on the Datasource
> instance.


> Everything works fine but when I start stress testing the tomcat servlet
> app, some of the connections take a very long time (e.g. >5 minutes). I have
> added logging to write out idle and active connections, and there always
> seem to be lots of idle connections left.

> Would anybody have any guidance as on how to identify and hopefully fix the
> issue?

> Thanks,

> Peter



-- 
Best regards,
 Christian                            mailto:christian.hufgard@gmx.de


---------------------------------------------------------------------
To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org