This project is archived and is in readonly mode.
benchmark DB time should calculate all DB connections instead of only the default one.
Reported by sliu | September 11th, 2008 @ 06:37 AM | in 2.x
description
benchmark DB time, rails only considered the default DB connection(in multiple DB situation).
details
check http://github.com/rails/rails/tr... line 55, 101
it only picked the run timing of the default DB connection:
ActionRecord::Base.connection.reset_runtime
thus, any other connections(i.e. connection to my reporting DB) is wrongly ignored. the result is: in production.log, you will see Rendering time nearly 100%, while DB time 0%.
solution
define ActiveRecord::Base::reset_db_runtime
def self.reset_db_runtime
timing = 0
self.active_connections.each_value do |conn|
timing += conn.reset_runtime
end
timing
end
replace every call in benchmarking.rb
ActiveRecord::Base.connection.reset_runtime
to
ActiveRecord::Base.reset_db_runtime
others
I am using rails-1.2.3, but it seems the latest code still have the issue.
Comments and changes to this ticket
-
Pratik December 20th, 2008 @ 06:19 PM
- Assigned user set to Pratik
- State changed from new to incomplete
Sounds like a valid issue. Could you please upload a patch here - http://rails.lighthouseapp.com/p... ?
Also, I think it's worth adding a method like ActiveRecord::Base.connection.reset_all_runtime.
Thanks.
-
Prem Sichanugrist (sikachu) January 22nd, 2010 @ 08:52 AM
- State changed from incomplete to stale
Create your profile
Help contribute to this project by taking a few moments to create your personal profile. Create your profile »
<h2 style="font-size: 14px">Tickets have moved to Github</h2>
The new ticket tracker is available at <a href="https://github.com/rails/rails/issues">https://github.com/rails/rails/issues</a>