Lighthouse has a new layout. Prefer the old one? Return to the old layout, and switch back any time from the link at the top of each page.

This project is archived and is in readonly mode.

benchmark DB time should calculate all DB connections instead of only the default one.

#1018

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.

Reported by sliu · September 11th, 2008 @ 06:37 AM

State: stale
Milestone: 2.x
Assigned to: Pratik Pratik
Importance: none

Activity

  1. Pratik
    Pratik
    • 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.

    December 20th, 2008 @ 06:19 PM

  2. Prem Sichanugrist (sikachu)
    Prem Sichanugrist (sikachu)
    • State changed from incomplete to stale

    January 22nd, 2010 @ 08:52 AM