Suchformular

Drupal Performance Profiling With Tracelytics

Posted on Mo, Feb 11, 2013 by Acquia Inc.

Written by: TraceView

At AppNeta, we’re always concerned with the performance of Drupal applications. Multiple times a day, we talk to our customers about how they can use TraceView to improve the performance of their Drupal applications. So we started thinking, how can we help Acquia customers improve the performance of their Drupal applications?

The answer: TraceView and the TraceView sales offer. AppNeta’s TraceView is the only SaaS-based, full-stack application performance monitoring solution available today. Combining full-stack application tracing with brilliant data visualization and segmenting, TraceView gives you unparalleled visibility into your PHP, Python, Java and Ruby web application performance. For a limited time, AppNeta is offering all Acquia customers a 50% discount on all TraceView annual subscription plans that are purchased through March 15, 2013! If you’d like to try TraceView, take advantage of our trial by visiting the Add-ons page in the Acquia Network.

When you’re ready to sign on for the 50% discount, contact your Acquia Account Manager to obtain the coupon code.

So now that we’ve got your attention, keep reading to learn how you can use TraceView (formerly Tracelytics) for Drupal Performance Profiling.

Drupal Performance Profiling With Tracelytics

Getting a comprehensive view of the causes of poor performance and latency in your Drupal instance can be tricky. AllPlayers.com, a Tracelytics user, has developed a module to integrate Drupal with Tracelytics and make the process of tracking Drupal performance much more straightforward. This module is an excellent example of how one can integrate custom code with the Tracelytics API to provide greater insight into application performance. Let’s explore the functionality of this module, and the source to see how that was implemented to report on full stack application tracing data.

Installation

Installing the Drupal module is as straightforward as downloading it and extracting the .tar.gz or zip. The files should then be installed in your Drupal installation, under sites/all/modules. You can also install the module through the Drupal Admin UI. You should have also already installed the instrumentation, including instrumentation for your web server and PHP.

FeaturesAdditional Layers

The module provides information on various Drupal-specific layers, each corresponding to a specific Drupal hook. Hooks are PHP functions called by the Drupal framework code at various times during request processing, and are used to generate Tracelytics layer entry and exit events. These events allow Tracelytics to determine how much time each request spent processing in an individual layer. The layers supported today are:

A controller and action pair is reported for each request by examining currently active Drupal “menu item”, which provides information on the code handling each request. This is particularly important with Drupal since almost all non-static requests are handled by the root index.php file, meaning the URL itself is not useful for categorizing a request.

Drupal provides a “watchdog” function for logging error/warning/debug messages. More severe messages can be forwarded to Tracelytics and will be tracked as errors.

Configuration

The above features can be turned on and off through the Drupal admin interface:

Note that it also integrates with Drush, a command line / shell scripting package.

How’s it work?

How does this module integrate with Tracelytics? If we examine the module code, we’ll see that it makes extensive use of the oboe_log function. This is a function added to PHP by the Tracelytics PHP instrumentation (“oboe”) module. It allows a code to log events, and is described in more detail in our knowledge base. The particular snippet logs an “info” event to report the partition based on the currently logged in user:

If we browse through the rest of the code (specially the tracelytics_early and tracelytics_late sub-modules), we’ll see that each module registers the same hook. The “early” module executes first and sends the “entry” event, while the “late” module executes last and sends the “exit” event. The order of Drupal module execution is controlled by assigning each module a weight.

Depending on the site configuration, various other modules would also register the same hooks and perform processing. Using the timestamps on the events allows Tracelytics to determine the processing time spent in each layer. Snippets for the “init” hooks (which are called for all non-cached page requests) are shown below:

tracelytics_early.module:

tracelytics_late.module:

The pattern used for other hooks is the same.

As you can see, integrating Tracelytics as part of your application is very straightforward! In future blog articles, we’ll explore integrations with other languages and platforms, including Python, Ruby, and Java.

Neuen Kommentar schreiben

Plain text

Keine HTML-Tags erlaubt.

Internet- und E-Mail-Adressen werden automatisch umgewandelt.

HTML - Zeilenumbrüche und Absätze werden automatisch erzeugt.

Filtered HTML

Use [acphone_sales], [acphone_sales_text], [acphone_support],
[acphone_international], [acphone_devcloud], [acphone_extra1] and
[acphone_extra2] as placeholders for Acquia phone numbers. Add class
"acquia-phones-link" to wrapper element to make number a link.

To post pieces of code, surround them with <code>...</code> tags. For PHP code, you can use <?php ... ?>, which will also colour it based on syntax.