This project is archived and is in readonly mode.

#1018 ✓stale
sliu

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

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>

Pages