Re: (was: similar problem) Connection Pool Dies

2004-02-24 Thread Harry Mantheakis
This is a follow-up message, for the record.

Following Antonio Fiol's kind prompting, I added the following Commons-DBCP
elements to the DataSource resource parameters specified in my application's
context fragment:

validationQuery -- select 'x' from dual
testWhileIdle -- true
timeBetweenEvictionRunsMillis -- 60
numTestsPerEvictionRun -- 10
minEvictableIdleTimeMillis -- 60

And I'm glad to say that my web application has maintained its connection(s)
despite being idle for several hours, overnight. I logged in immediately
this morning.

It seems easy enough once you know how, but I suppose trying to wear both
developer and administrator hats is a bit of a tall order: there is just so
much stuff!

Good stuff, I hasten to add. Really good stuff :-)

Thanks again to Antonio, and the others who responded.

Kind regards

Harry Mantheakis
London, UK



 Hi Harry,
 
 
 I'm going to try and hijack this thread if I may (!) because, as you say...
  
 
 Welcome! ;-)
 
 [...] The other Tomcat server runs on a Red Hat 9 machine at my home. It
 connects
 to the above Oracle DB box - far away - using the same static IP address.
 
 [...] The problem is with the the DB connections on my own RH9 server - they
 just
 *die* after a period of inactivity :-(
 
 That period of inactivity can be as little as half and hour.
 [...]
  
 
 
 Very typical behaviour... at least in our scenario.
 
 BTW - the 'first' login attempt (which reactivates the connection pooling)
 never gets a response - it just times out.
  
 
 
 Very true.
 
 Do you think you can shed any light on this?
 
 
 I'll try.
 
 I have read just about every
 single forum discussion - from Tomcat-User to Commons DBCP to you-name-it,
 and I just cannot find the answer.
  
 
 I have a very strict firewall policy on my Linux box - using iptables. Only
 port 80 packets get through. Nothing else.
 
 Does that have something to do with my problem? Is there an ICMP port that I
 need to open up?
  
 
 
 Nope. No ICMP is needed for keepalives.
 The reason of your headaches may be in /proc/sys/net/ipv4/netfilter
 There, you have several timeout values. Check
 ip_conntrack_tcp_timeout_established.
 
 Anyway, however high you set the values in there, there will be an upper
 limit. So, I think you need to avoid your connection being idle, so that
 your firewall does not drop it, even with low timeout values. To do
 that, I suggest to use the mechanism provided by DBCP to test idle
 connections every now and then.
 
 testWhileIdle -- true
 validationQuery -- select 'x' from dual
 timeBetweenEvictionRunsMillis -- 30 (five minutes. Or longer, as
 far as it works...)
 
 On Monday, I may send you out production values. Now I don't have them,
 so I worked out some ;-)
 
 I am not sure whether you will need to set some more parameters. The
 authoritative source of information is:
 http://jakarta.apache.org/commons/dbcp/configuration.html
 
 Other sources (link below) say that you also have to set
 numTestsPerEvictionRun. I'd suggest a value equal to maxIdle.
 http://www.mail-archive.com/[EMAIL PROTECTED]/msg05339.html
 
 And he also proposes another solution (which I have not tested):
 
 ---
 You can prevent that your firewall from dropping the connection using
 a oracle technique.
 SQL*Net has a parameter which defines time interval to send a probe
 message to identify if the client process is still alive
 - SQLNET.EXPIRE_TIME, sqlnet.ora file on the server side.
 SQLNET.EXPIRE_TIME = your_value
 Set it to something like 30 when your firewall drops connection after
 60 minutes.
 ---
 
 
 
 
 I hope that helped.
 
 
 Antonio Fiol
 
 
 
 
 


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: (was: similar problem) Connection Pool Dies

2004-02-20 Thread Antonio Fiol BonnĂ­n
Hi Harry,


I'm going to try and hijack this thread if I may (!) because, as you say...
 

Welcome! ;-)

[...] The other Tomcat server runs on a Red Hat 9 machine at my home. It connects
to the above Oracle DB box - far away - using the same static IP address.
[...] The problem is with the the DB connections on my own RH9 server - they just
*die* after a period of inactivity :-(
That period of inactivity can be as little as half and hour.
[...]
 

Very typical behaviour... at least in our scenario.

BTW - the 'first' login attempt (which reactivates the connection pooling)
never gets a response - it just times out.
 

Very true.

Do you think you can shed any light on this?

I'll try.

I have read just about every
single forum discussion - from Tomcat-User to Commons DBCP to you-name-it,
and I just cannot find the answer.
 

I have a very strict firewall policy on my Linux box - using iptables. Only
port 80 packets get through. Nothing else.
Does that have something to do with my problem? Is there an ICMP port that I
need to open up?
 

Nope. No ICMP is needed for keepalives.
The reason of your headaches may be in /proc/sys/net/ipv4/netfilter
There, you have several timeout values. Check 
ip_conntrack_tcp_timeout_established.

Anyway, however high you set the values in there, there will be an upper 
limit. So, I think you need to avoid your connection being idle, so that 
your firewall does not drop it, even with low timeout values. To do 
that, I suggest to use the mechanism provided by DBCP to test idle 
connections every now and then.

testWhileIdle -- true
validationQuery -- select 'x' from dual
timeBetweenEvictionRunsMillis -- 30 (five minutes. Or longer, as 
far as it works...)

On Monday, I may send you out production values. Now I don't have them, 
so I worked out some ;-)

I am not sure whether you will need to set some more parameters. The 
authoritative source of information is:
http://jakarta.apache.org/commons/dbcp/configuration.html

Other sources (link below) say that you also have to set 
numTestsPerEvictionRun. I'd suggest a value equal to maxIdle.
http://www.mail-archive.com/[EMAIL PROTECTED]/msg05339.html

And he also proposes another solution (which I have not tested):

---
You can prevent that your firewall from dropping the connection using 
a oracle technique.
SQL*Net has a parameter which defines time interval to send a probe 
message to identify if the client process is still alive
- SQLNET.EXPIRE_TIME, sqlnet.ora file on the server side. 
SQLNET.EXPIRE_TIME = your_value
Set it to something like 30 when your firewall drops connection after 
60 minutes.
---
 



I hope that helped.

Antonio Fiol






smime.p7s
Description: S/MIME Cryptographic Signature


Re: (was: similar problem) Connection Pool Dies

2004-02-20 Thread Harry Mantheakis
Thank you Antonio (!)

Your suggestions sound very plausible - I shall look into them and I promise
to post a follow up (for the record) in due course, though it might take me
a couple of days.

Many thanks indeed, and kind regards

Harry Mantheakis
London, UK


 Hi Harry,
 
 
 I'm going to try and hijack this thread if I may (!) because, as you say...
  
 
 Welcome! ;-)
 
 [...] The other Tomcat server runs on a Red Hat 9 machine at my home. It
 connects
 to the above Oracle DB box - far away - using the same static IP address.
 
 [...] The problem is with the the DB connections on my own RH9 server - they
 just
 *die* after a period of inactivity :-(
 
 That period of inactivity can be as little as half and hour.
 [...]
  
 
 
 Very typical behaviour... at least in our scenario.
 
 BTW - the 'first' login attempt (which reactivates the connection pooling)
 never gets a response - it just times out.
  
 
 
 Very true.
 
 Do you think you can shed any light on this?
 
 
 I'll try.
 
 I have read just about every
 single forum discussion - from Tomcat-User to Commons DBCP to you-name-it,
 and I just cannot find the answer.
  
 
 I have a very strict firewall policy on my Linux box - using iptables. Only
 port 80 packets get through. Nothing else.
 
 Does that have something to do with my problem? Is there an ICMP port that I
 need to open up?
  
 
 
 Nope. No ICMP is needed for keepalives.
 The reason of your headaches may be in /proc/sys/net/ipv4/netfilter
 There, you have several timeout values. Check
 ip_conntrack_tcp_timeout_established.
 
 Anyway, however high you set the values in there, there will be an upper
 limit. So, I think you need to avoid your connection being idle, so that
 your firewall does not drop it, even with low timeout values. To do
 that, I suggest to use the mechanism provided by DBCP to test idle
 connections every now and then.
 
 testWhileIdle -- true
 validationQuery -- select 'x' from dual
 timeBetweenEvictionRunsMillis -- 30 (five minutes. Or longer, as
 far as it works...)
 
 On Monday, I may send you out production values. Now I don't have them,
 so I worked out some ;-)
 
 I am not sure whether you will need to set some more parameters. The
 authoritative source of information is:
 http://jakarta.apache.org/commons/dbcp/configuration.html
 
 Other sources (link below) say that you also have to set
 numTestsPerEvictionRun. I'd suggest a value equal to maxIdle.
 http://www.mail-archive.com/[EMAIL PROTECTED]/msg05339.html
 
 And he also proposes another solution (which I have not tested):
 
 ---
 You can prevent that your firewall from dropping the connection using
 a oracle technique.
 SQL*Net has a parameter which defines time interval to send a probe
 message to identify if the client process is still alive
 - SQLNET.EXPIRE_TIME, sqlnet.ora file on the server side.
 SQLNET.EXPIRE_TIME = your_value
 Set it to something like 30 when your firewall drops connection after
 60 minutes.
 ---
 
 
 
 
 I hope that helped.
 
 
 Antonio Fiol
 
 
 
 
 


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]