Rack middleware for shared connection pools?

41 views
Skip to first unread message

Jeff

unread,
Mar 27, 2014, 12:05:30 PM3/27/14
to rubyonra...@googlegroups.com
I have a Rails app that makes connections to other DBs. There may be multiple users connecting to multiple DBs.

The app makes a database connection as part of an action.  However, I noticed a problem: there's too many DB connections remaining open, which is causing the DB to not have enough connections remaining for new connections.

So the answer is using a shared connection pool. Importantly, the connection pool needs to be shared amongst different actions / HTTP requests.

Is there any middleware that extends Sequel's or ActiveRecord's connection pool to do this? (Or some code that someone can suggest to do this?)

Thanks.

Frederick Cheung

unread,
Mar 27, 2014, 12:28:50 PM3/27/14
to rubyonra...@googlegroups.com


On Thursday, March 27, 2014 4:05:30 PM UTC, Jeff wrote:
I have a Rails app that makes connections to other DBs. There may be multiple users connecting to multiple DBs.

The app makes a database connection as part of an action.  However, I noticed a problem: there's too many DB connections remaining open, which is causing the DB to not have enough connections remaining for new connections.

So the answer is using a shared connection pool. Importantly, the connection pool needs to be shared amongst different actions / HTTP requests.

 
I don't know of a middleware that does this but you might want to look at the connection_pool gem ( https://github.com/mperham/connection_pool

Fred
Reply all
Reply to author
Forward
0 new messages