ActiveRecord::Base.establish_connection causing slowdown
--------------------------------------------------------
Key: JRUBY-3764
URL: http://jira.codehaus.org/browse/JRUBY-3764
Project: JRuby
Issue Type: Bug
Affects Versions: JRuby 1.3.1
Environment: OS X and linux
Reporter: Miika Leppänen
Assignee: Thomas E Enebo
Priority: Critical
Attachments: Slowdown.zip
When using ActiveRecord::Base.establish_connection to select database for every
request, responses are incrementally slowing down with glassfish and tomcat,
but not with webrick(jruby/MRI) or mongrel.
Can be reproduced with attached application by calling repeatedly posts
controller.
Or by creating application_controller similiar to this:
{code}
class ApplicationController < ActionController::Base
helper :all # include all helpers, all the time
protect_from_forgery # See ActionController::RequestForgeryProtection for
details
before_filter [:select_database]
after_filter [:close_db_connection]
def select_database
options = {'database' => 'Slowdown'}
ActiveRecord::Base.establish_connection(
ActiveRecord::Base.configurations[RAILS_ENV].merge(options))
end
def close_db_connection
ActiveRecord::Base.clear_active_connections!
end
end
{code}
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
---------------------------------------------------------------------
To unsubscribe from this list, please visit:
http://xircles.codehaus.org/manage_email