2

I have several Drupal sites with which I'm using New Relic to help monitor and debug performance issues.

I've been finding that when viewing the "Web Transactions" section under "Monitoring", that a large percentage of time is spent in "/theme". When I click in to view a trace, then view the Trace details, I often find that the majority of the time is listed in a rows named "Application Code (in /theme)".

The help link beside "Application Code (in /theme)" takes me to New Relic's PHP Custom Metrics Collection page. The documentation is clear enough, but what I don't understand is how to make this useful in Drupal. I'm guessing this is difficult for me because of Drupal's hook system, and (again guessing) that the "Application Code" that New Relic is referring to in this case are calls to theme() functions.

Is there something that I can do to get more useful information out of New Relic? First thing that comes to mind is "killing a kitten" and hacking core's theme() function to insert a New Relic Custom Metric, but I'd prefer not to do that (nor do I know for certain it will help!).

  • I just looked through 5 mid sized D6 sites that I monitor with New Relic and only one of then has any time spent in /theme - 0.12% over the last 24 hours... We can talk about setting up custom metrics, but its probably something more basic. What are the Avg. Response Time and Throughput for /theme in the last 24 hours? – mrP May 21 '13 at 22:41
  • Avg Response Time: 7080 ms, Throughput 0.18 rpm. – rcourtna May 22 '13 at 13:22
0

New Relic offers Drupal monitoring as part of their paid Standard plan to collect metrics for Modules, Hooks, and Views.

The collection of Drupal-specific metrics can be controlled by the ini setting newrelic.framework.drupal.modules. It is enabled by default (in versions 3.0 and higher), and can be disabled with:

newrelic.framework.drupal.modules = 0 Though this setting uses the word "modules", it controls the collection of all Drupal metrics: modules, views, and hooks.

The PHP agent collects metrics for the following:

Modules: Versions 2.5+. These metrics indicate time spent within each Drupal module. In versions 3.5+, time is calculated from the hook dispatch functions module_invoke and module_invoke_all. In previous versions, time was calculated from functions from a file with the ".module" extension where the file name and function prefix were a match. Hooks: Versions 3.5+. These metrics indicate time spent within each Drupal hook. Time is calculated from the hook dispatch functions module_invoke and module_invoke_all. Views: Versions 3.5+. These metrics indicate time spent within a view's view::execute method.

You are correct that New Relic: “Application Code (in /theme)” refers to the execution of the theme() function. Given the throughput you referenced, this seems to be a minor issue, though there is definitely room for optimization if you're seeing ~7000ms response time. I typically see around 400-500ms with similar throughput.

  • I just noticed the new support for Hooks and Views. Pretty cool stuff (although Jooks only seems to provide pretty high-level info and doesn't seem to let you drill down to a list of the invokers). – rcourtna May 22 '13 at 18:29

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.