Glassfish database pool and rails persistent connections


#1

I have read Arun G.'s
bloghttp://weblogs.java.net/blog/arungupta/archive/2007/09/totd_9_using_jd.html
on using jruby/rails with a glassfish database connection pool and I
have
been able to set this up. I have a question regarding this though that
I’m
sure someone has encountered. Doesn’t rails use persistent connections,
which would prevent them from being returned to the pool?

I am concerned (and some simple tests seem to bear this out) that
setting up
a deployment that handles multiple simultaneous users will saturate the
connection pool and some of the threads will never get a connection.

If this is the case, can I configure rails to not use persistent
connections, or can I use an idle timeout setting on glassfish to
reclaim
idle connections?

Thanks,

James


#2

Found the answer
here.http://blog.linkedin.com/blog/2008/08/jdbc-connection.html


#3

Nice find - had seen the presentation before but didn’t realise
JRuby-Rack bundled the connection pool hack; shouldn’t that mean
there’s no need to do anything for Rails bundled with Warbler to ‘just
work’?

On Thu, Oct 23, 2008 at 7:46 PM, James N. removed_email_address@domain.invalid
wrote:

Found the answer here.

On Thu, Oct 23, 2008 at 12:15 PM, James N. removed_email_address@domain.invalid
wrote:

I have read Arun G.'s blog on using jruby/rails with a glassfish
database connection pool and I have been able to set this up. I have a
question regarding this though that I’m sure someone has encountered.
Doesn’t rails use persistent connections, which would prevent them from
being returned to the pool?


To unsubscribe from this list, please visit:

http://xircles.codehaus.org/manage_email

#4

I am curious - what would the benefit be using a connection pool with
rails <= 2.1 ?

On Fri, Oct 24, 2008 at 11:21 AM, Dick D. removed_email_address@domain.invalid
wrote:

I have read Arun G.'s blog on using jruby/rails with a glassfish


To unsubscribe from this list, please visit:

http://xircles.codehaus.org/manage_email

#5

Dick, just FYI, JRuby-Rack doesn’t bundle the connection pool hack –
I thought it was a little dangerous to assume that you’re always
running with a connection pool. So you’ll still have to apply it
yourself.

The “hack” really needs to be applied to ActiveRecord-JDBC, but I
don’t have a foolproof way of detecting that you’re using a connection
pool. More likely is that I’ll modify AR-JDBC to work with Rails 2.2’s
connection pooling.

Cheers,
/Nick

On Fri, Oct 24, 2008 at 4:21 AM, Dick D. removed_email_address@domain.invalid
wrote:

I have read Arun G.'s blog on using jruby/rails with a glassfish


To unsubscribe from this list, please visit:

http://xircles.codehaus.org/manage_email

#6

On Mon, Oct 27, 2008 at 2:34 PM, Nick S. removed_email_address@domain.invalid
wrote:

Dick, just FYI, JRuby-Rack doesn’t bundle the connection pool hack –
I thought it was a little dangerous to assume that you’re always
running with a connection pool. So you’ll still have to apply it
yourself.

That’s fine, thanks for clarifying.


To unsubscribe from this list, please visit:

http://xircles.codehaus.org/manage_email

#7

Probably. Unfortunately, we still haven’t migrated from goldspike for
our
project.


#8

Hi James,

You can configure ActiveRecord to disconnect after every query as
described at:

http://blog.linkedin.com/blog/2008/08/jdbc-connection.html

Thanks,
-Arun

James N. wrote:

connection.


Application Platform, Sun Microsystems, Inc.
Blog: http://blogs.sun.com/arungupta


To unsubscribe from this list, please visit:

http://xircles.codehaus.org/manage_email