Performance Zone is brought to you in partnership with:

Leigh has been in the technology industry for over 15 years, writing marketing and technical documentation for Sun Microsystems, Wells Fargo, and more. She currently works at New Relic as a Marketing Manager. Leigh is a DZone MVB and is not an employee of DZone and has posted 106 posts at DZone. You can read more from them at their website. View Full User Profile

Thread Profiling: See Exactly What Your App Is Doing

04.24.2013
| 2056 views |
  • submit to reddit

RailsConf 2013 logo

This post comes from Sam Goldstein at the New Relic Blog.

RailsConf 2013 is right around the corner! And to celebrate, we’re publishing a series of blog post that highlight what’s new and exciting in the world of New Relic’s Ruby support. Don’t forget to check out yesterday’s post on Cross Application Tracing.

New Relic tries to bubble up the most significant performance data from your apps like database queries and response times. But sometimes you need to deep dive into how your code is executing to solve a problem.

For times like this, the New Relic Ruby agent provides a low overhead sampling profiler that collects call graphs for running production apps. These can be triggered on demand from the New Relic UI.

The Thread Profiler works by spawning a background thread that takes snapshots of other threads’ backtraces at regular intervals. Over time, the profiles builds up a good representation of where your application is spending most of its time down to the method call level. New Relic’s web UI visualizes Thread Profiles in an interactive hierarchical tree format, highlighting the ‘hot’ methods where the app is spending the most time.

New Relic Ruby Thread Profile

Our own Jason Clark gave a talk on this subject recently at Mountain West RubyConf. His session, DIY::Thread.profile — Light-Weight Profiling in Pure Ruby, described the techniques he used to write this pure Ruby profiler.

For more information on our Thread Profiling feature, see our Thread Profiler documentation.

Next up: Living on the Edge — Rails 4 & Ruby 2

Published at DZone with permission of Leigh Shevchik, author and DZone MVB. (source)

(Note: Opinions expressed in this article and its replies are the opinions of their respective authors and not those of DZone, Inc.)