You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@commons.apache.org by raj <ra...@yahoo.com> on 2004/01/29 09:09:14 UTC

DBCP - Connection pool --How to close bad connections

Hi,
Thanks for information in advance.
I am running into an issue where some bad connections
are hanging not getting closed and eventually going
away once I restart the server. 

Problem is some times there are too many effecting
performance.

I am closing all the connections in the code.
I am using poolingDataSource.

Is there any parameter in DBCP which will determine
whether an ACTIVE connection is valid or not and then
if not close the connection without effecting other
Active connections...

Some thing like Using For How much time this
connection is Active..

Thanks for the help.
Regards..RAJ

__________________________________
Do you Yahoo!?
Yahoo! SiteBuilder - Free web site building tool. Try it!
http://webhosting.yahoo.com/ps/sb/

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


Re: DBCP - Connection pool --How to close bad connections

Posted by Dirk Verbeeck <di...@pandora.be>.
Firewall connection timeout is a very common problem but that's only 
when the connection is idle (low load).
You have database specific solutions for this. (but the checkOnBorrow 
will do just fine)

If you think there is an overload then you can monitor the number of 
active/idle connections. Normally the checkOnBorrow shouldn't be a 
problem.

I assume you are using DBCP 1.1. In the latest nightly build there is 
one performance improvement related to the validationQuery. If you 
have a performance bottleneck with the validationQuery and it goes 
away when you don't do any tests then you can try a nightly build.

-- Dirk


raj wrote:
> Thanks very much Dirk,
> I am closing connections every where. I am trying to
> find leaks but could not as our testing environment
> works fine performance and other.
> In production We are seeing performance issues which
> are effecting customers.
> 
> Here are my speculations --
> 1)Firewal may be dropping connections--
> 2)Some other source creating stale(bad) connections
> but Connection pool not dropping
> 3)Some connections are Active for long time (Not
> source code issue -Might be some other reason.
> 
> We are using validationQuery along with checkOnReturn
> and CheckOnBorrow(I forgot exact names)..
> 
> 1)I do I check leaks --
> 2)Does check on Borrow causes over load on connection
> pool
> 3)If checkonreturn is there then why
> checkOnBorrow(Whats the reason for using both--Unless
> there is huge difference)...(I know one validates when
> connection is returned and one when connection is
> borrowed.
> 
> Some time A bad connection which is Active in terms of
> COnnection POol will become stale connection by
> Firewall after 60Min and then will be returned to
> connection pool and validated and then eventually
> dropped as validation fails..
> 
> Do we have to wait for 60 min till firewall returns or
> is there any way we can validate in between(DB
> perspective atleast)..
> 
> Sorry for asking too many questions ..I appreciate
> your(ANy ones) time and help.
> 
> Thanks a bunch..
> --- Dirk Verbeeck <di...@pandora.be> wrote:
> 
>>The parameter you are looking for is
>>"validationQuery" and then enable 
>>one of the connection validation tests.
>>
>>This only helps when you are getting SQLExceptions
>>about broken 
>>connections.
>>
>>If you run out of connection because they aren't
>>closed everywhere 
>>then you have to look for the leak.
>>
>>-- Dirk
>>
>>
>>raj wrote:
>>
>>
>>>Hi,
>>>Thanks for information in advance.
>>>I am running into an issue where some bad
>>
>>connections
>>
>>>are hanging not getting closed and eventually
>>
>>going
>>
>>>away once I restart the server. 
>>>
>>>Problem is some times there are too many effecting
>>>performance.
>>>
>>>I am closing all the connections in the code.
>>>I am using poolingDataSource.
>>>
>>>Is there any parameter in DBCP which will
>>
>>determine
>>
>>>whether an ACTIVE connection is valid or not and
>>
>>then
>>
>>>if not close the connection without effecting
>>
>>other
>>
>>>Active connections...
>>>
>>>Some thing like Using For How much time this
>>>connection is Active..
>>>
>>>Thanks for the help.
>>>Regards..RAJ
>>
>>
>>
>>
>>
> ---------------------------------------------------------------------
> 
>>To unsubscribe, e-mail:
>>commons-user-unsubscribe@jakarta.apache.org
>>For additional commands, e-mail:
>>commons-user-help@jakarta.apache.org
>>
> 
> 
> 
> __________________________________
> Do you Yahoo!?
> Yahoo! SiteBuilder - Free web site building tool. Try it!
> http://webhosting.yahoo.com/ps/sb/
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: commons-user-help@jakarta.apache.org
> 
> 
> 
> 



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


Re: DBCP - Connection pool --How to close bad connections

Posted by raj <ra...@yahoo.com>.
Thanks very much Dirk,
I am closing connections every where. I am trying to
find leaks but could not as our testing environment
works fine performance and other.
In production We are seeing performance issues which
are effecting customers.

Here are my speculations --
1)Firewal may be dropping connections--
2)Some other source creating stale(bad) connections
but Connection pool not dropping
3)Some connections are Active for long time (Not
source code issue -Might be some other reason.

We are using validationQuery along with checkOnReturn
and CheckOnBorrow(I forgot exact names)..

1)I do I check leaks --
2)Does check on Borrow causes over load on connection
pool
3)If checkonreturn is there then why
checkOnBorrow(Whats the reason for using both--Unless
there is huge difference)...(I know one validates when
connection is returned and one when connection is
borrowed.

Some time A bad connection which is Active in terms of
COnnection POol will become stale connection by
Firewall after 60Min and then will be returned to
connection pool and validated and then eventually
dropped as validation fails..

Do we have to wait for 60 min till firewall returns or
is there any way we can validate in between(DB
perspective atleast)..

Sorry for asking too many questions ..I appreciate
your(ANy ones) time and help.

Thanks a bunch..
--- Dirk Verbeeck <di...@pandora.be> wrote:
> The parameter you are looking for is
> "validationQuery" and then enable 
> one of the connection validation tests.
> 
> This only helps when you are getting SQLExceptions
> about broken 
> connections.
> 
> If you run out of connection because they aren't
> closed everywhere 
> then you have to look for the leak.
> 
> -- Dirk
> 
> 
> raj wrote:
> 
> > Hi,
> > Thanks for information in advance.
> > I am running into an issue where some bad
> connections
> > are hanging not getting closed and eventually
> going
> > away once I restart the server. 
> > 
> > Problem is some times there are too many effecting
> > performance.
> > 
> > I am closing all the connections in the code.
> > I am using poolingDataSource.
> > 
> > Is there any parameter in DBCP which will
> determine
> > whether an ACTIVE connection is valid or not and
> then
> > if not close the connection without effecting
> other
> > Active connections...
> > 
> > Some thing like Using For How much time this
> > connection is Active..
> > 
> > Thanks for the help.
> > Regards..RAJ
> 
> 
> 
> 
>
---------------------------------------------------------------------
> To unsubscribe, e-mail:
> commons-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail:
> commons-user-help@jakarta.apache.org
> 


__________________________________
Do you Yahoo!?
Yahoo! SiteBuilder - Free web site building tool. Try it!
http://webhosting.yahoo.com/ps/sb/

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


Re: DBCP - Connection pool --How to close bad connections

Posted by Dirk Verbeeck <di...@pandora.be>.
The parameter you are looking for is "validationQuery" and then enable 
one of the connection validation tests.

This only helps when you are getting SQLExceptions about broken 
connections.

If you run out of connection because they aren't closed everywhere 
then you have to look for the leak.

-- Dirk


raj wrote:

> Hi,
> Thanks for information in advance.
> I am running into an issue where some bad connections
> are hanging not getting closed and eventually going
> away once I restart the server. 
> 
> Problem is some times there are too many effecting
> performance.
> 
> I am closing all the connections in the code.
> I am using poolingDataSource.
> 
> Is there any parameter in DBCP which will determine
> whether an ACTIVE connection is valid or not and then
> if not close the connection without effecting other
> Active connections...
> 
> Some thing like Using For How much time this
> connection is Active..
> 
> Thanks for the help.
> Regards..RAJ




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