Home / Drupal Performance Profiling With Tracelytics

Drupal Performance Profiling With Tracelytics

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.

To get started with TraceView, follow these steps:

  1. If you’d like to try TraceView first, sign up for the free trial through the Acquia Network.
  2. Enable the TraceView agent and install to begin tracing your Drupal app.
  3. 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.


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.

Additional 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:

Controller / Action

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.

  • Controller: The ‘page_callback’ function associated with the active Drupal menu item (from the menu_get_item() call).
  • Action: The first argument in the ‘page_arguments’ array associated with the active menu item.

Top Controllers

Request Partitioning

Requests are associated with a specific partition, depending on the type of request. This is crucial for determining where your heaviest requests come from, and when. The support partitions today are:
Request Partitioning

  • Admin : Drupal admin userdrupal performance partitions
  • Anonymous : Anonymous user (not logged-in)
  • Authenticated : Logged in user
  • Cron : Periodic / cron execution
  • Drush : Command line shell / script (see www.drush.org)

Complete Error Logging

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.


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:



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.

Add new comment

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.

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.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Allowed HTML tags: <a> <em> <strong> <cite> <blockquote> <code> <ul> <ol> <li> <h4> <h5> <h2> <img>
  • Lines and paragraphs break automatically.
By submitting this form, you accept the Mollom privacy policy.