Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » EclipseLink » Connection pooling and network timeouts
Connection pooling and network timeouts [message #648563] Thu, 13 January 2011 14:27 Go to next message
William Korb is currently offline William Korb
Messages: 7
Registered: January 2011
Junior Member
Hello,

I am using the connection pooling that is built in to EL in an app that runs on a non-JEE web server. We are seeing a problem where a network firewall is forcibly closing idle connections after an hour, and while EL resubmits the query, it takes 15 minutes for the timeout and retry to occur.

My question is this: is there a way I can tell the EMF to closed pooled connections after they have been idle for a period of time (e.g., 30 minutes) so as to avoid the firewall's non-graceful closing of the connections?

Thanks,
Bill
Re: Connection pooling and network timeouts [message #648565 is a reply to message #648563] Thu, 13 January 2011 14:30 Go to previous messageGo to next message
William Korb is currently offline William Korb
Messages: 7
Registered: January 2011
Junior Member
Oh, and one other thought. Our network admin tells me that if there is any chatter on the connection, it will not be timed out.

For example, as this connection is to an oracle database, can I tell EL to do a keep-alive check every minute or something using a default query (e.g., "select sysdate from dual")?

Thanks,
Bill
Re: Connection pooling and network timeouts [message #648588 is a reply to message #648565] Thu, 13 January 2011 15:27 Go to previous messageGo to next message
James Sutherland is currently offline James Sutherland
Messages: 1939
Registered: July 2009
Location: Ottawa, Canada
Senior Member

EclipseLink does not support any keepAlive in its internal connection pooling. You can either create your own background thread to ping the EclipseLink connection pool, or use a third party connection pool that supports a keepAlive (maybe Oracle UCP).

You can also try setting a timeout on your queries to decrease the timeout.


James : Wiki : Book : Blog : Twitter
Re: Connection pooling and network timeouts [message #685872 is a reply to message #648588] Mon, 20 June 2011 13:19 Go to previous messageGo to next message
LA  is currently offline LA
Messages: 13
Registered: June 2011
Junior Member
No Message Body
Re: Connection pooling and network timeouts [message #685873 is a reply to message #685872] Mon, 20 June 2011 13:24 Go to previous messageGo to next message
LA  is currently offline LA
Messages: 13
Registered: June 2011
Junior Member
I'm using EL connection pooling and I'm getting exception like:

...com.mysql.jdbc.exceptions.jdbc4.MySQLNonTransientConnectionException: Could not create connection to database server. Attempted reconnect 3 times. Giving up.
....
Caused by: com.mysql.jdbc.exceptions.jdbc4.MySQLNonTransientConnectionException: Too many connections

Got the latest stable release of EL and mysql connector.

is there any bug with EL pooling mechanism? should I use c3p0?

Re: Connection pooling and network timeouts [message #685884 is a reply to message #685873] Mon, 20 June 2011 14:04 Go to previous messageGo to next message
James Sutherland is currently offline James Sutherland
Messages: 1939
Registered: July 2009
Location: Ottawa, Canada
Senior Member

When do you get this error? How many connections have you configured your EclipseLink connection pool with, and how many connections are allowed on your database?

The MySQL error seems to indicate that you have used too many connections than allowed. So either decrease your connection pool size, or increase you MySQL connection limit.

Also what version of EclipseLink are you using?


James : Wiki : Book : Blog : Twitter
Re: Connection pooling and network timeouts [message #686074 is a reply to message #685884] Tue, 21 June 2011 15:28 Go to previous messageGo to next message
LA  is currently offline LA
Messages: 13
Registered: June 2011
Junior Member
When I found out the problem msqld was accepting 151 and pool was set to 200...
but even changing to 150 the problem seems to remain...

Wouldn't EL use only 150 even if the pool was 200?

changed to EclipseLink 2.1.3 was using EclipseLink 2.2.0

Re: Connection pooling and network timeouts [message #687949 is a reply to message #686074] Thu, 23 June 2011 15:00 Go to previous messageGo to next message
James Sutherland is currently offline James Sutherland
Messages: 1939
Registered: July 2009
Location: Ottawa, Canada
Senior Member

200 or even 150 seems very high. What if you reduce your pool size to 50? What type of hardware are you on?

Include how you configured your connection pooling.


James : Wiki : Book : Blog : Twitter
Re: Connection pooling and network timeouts [message #688238 is a reply to message #687949] Fri, 24 June 2011 08:42 Go to previous message
LA  is currently offline LA
Messages: 13
Registered: June 2011
Junior Member
Got 2 Gb of RAM on a 2 CPU virtual machine..


config:

<!--
<property name="eclipselink.jdbc.read-connections.min" value="30"/>
<property name="eclipselink.jdbc.read-connections.max" value="150"/>
<property name="eclipselink.jdbc.read-connections.shared" value="true"/>
<property name="eclipselink.jdbc.write-connections.min" value="10"/>
<property name="eclipselink.jdbc.write-connections.max" value="80"/>
-->
<!-- Now I'm using this...-->
<property name="eclipselink.jdbc.connections.min" value="50" />
<property name="eclipselink.jdbc.connections.max" value="150" />
<property name="eclipselink.jdbc.connections.initial" value="25" />
Previous Topic:@ManyToOne in multiple jars with Glassfish/EclipseLink
Next Topic:(no subject)
Goto Forum:
  


Current Time: Tue Oct 21 10:25:52 GMT 2014

Powered by FUDForum. Page generated in 0.02028 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software