> Last I looked at the AR DB connection pool, it never released > connections for active threads. That means you MUST have at > least as many connections in your pool as you have active > threads. We are calling ActiveRecord::Base.clear_active_connections! after each request. Rails should do this automatically. See http://api.rubyonrails.org/classes/ActiveRecord/Co... > In a web app, the threads are often short lived, and the > connections they occupy are released when the thread dies. > This is not the case for long-lived threads in a non-web app. In a Java servlet container such as Tomcat, Glassfish, Jetty, etc., there is typically a thread pool of long-lived threads servicing HTTP requests, even if each request is short. These are not short-lived threads performing misc. background tasks; these are the equivalent of, for example, multiple Unicorn worker processes, except in JRuby they can be threads. In my particular case, I'm running several JRuby apps in the same servlet container and sharing the same thread pool. Each app has its own database and connection pool however. -- Patrick Mahoney
on 2012-05-24 16:16
on 2012-05-25 16:34
Here is a small writeup with some nicer data: http://polycrystal.org/2012/05/24/activerecord_con...
Please log in before posting. Registration is free and takes only a minute.
Existing account
(Switch to SSL-encrypted connection)
NEW: Do you have a Google/GoogleMail or Yahoo account? No registration required!
Log in with Google account | Log in with Yahoo account
Log in with Google account | Log in with Yahoo account
No account? Register here.