DirectSQL... not seeing where this is coming from?
All of the most dissatisfying methods are being caused by what newrelic is reporting as directsql, the only issue is there are only a couple _by_sql calls in the entire app, none of which should be called on these controller methods. Could something else be going on?
We also run backgroundrb from 2 additional servers that share access to the main mysql db, could newrelic be getting confused?
Thanks!
Todd
Comments are currently closed for this discussion. You can start a new one.
Support Staff 2 Posted by Ralph Bodenner on 18 Jan, 2010 07:21 PM
Hi Todd,
The background jobs on separate servers won't be included in the SQL time RPM is measuring--we don't measure database ops on the DB directly, but through ActiveRecord calls in the application threads.
The DIRECTSQL numbers account for time spent in the DB outside the usual ActiveRecord model methods (find, save, etc.). There are a couple ways to get more insight into the mystery SQL:
Use Transaction Traces (a Silver feature) to drill down into specific slow transactions and see what SQL is being executed, and by which code paths.
Run the RPM agent in Developer Mode on your desktop. Hit the dissatisfying actions and you can drill down into each one's execution path in great detail, including the SQL. This isn't recommended for use in production, but you can set up a local_production environment if you only see the extra SQL with your production workload: http://blog.newrelic.com/2009/01/22/rails_envlocal_production/
If you discover that the DIRECTSQL time is really happening within a find or save, let us know--it might be a bug.
Ralph
Support Staff 3 Posted by Bill Kayser on 18 Jan, 2010 09:07 PM
Todd, one thing that might help is upgrading to a newer version of the Agent. This might give us a little better insight on the source of the metric. The ActiveRecord instrumentation has improved substantially.
Support Staff 4 Posted by Devorah on 08 Feb, 2010 07:15 PM
Todd,
Its been a few weeks, so I wanted to check in with you and see if Bill and Ralph's suggestions helped clear the issue.
Please let me know so that if you're still having problems we can help resolve them ASAP.
Thanks,
Devorah
Devorah resolved this discussion on 18 Feb, 2010 07:26 PM.