Insight into the behavior of the Ruby virtual machine can help you understand and improve the performance of your application as a whole. New Relic gathers some key metrics that can help you get a better picture of what your Ruby VM is doing. This can also help you to evaluate the impact of adjustments to VM configuration to improve performance.
Ruby VM metric collections are available in versions 3.8.0 or higher of the Ruby agent (although earlier versions did support collection of some basic garbage collection measurements).
In addition, in order to use this feature, you'll need to be on a Ruby version compatible with MRI (Matz's Ruby Interpreter, the most commonly used Ruby implementation) 1.9.2 or higher. The sections below on each individual measurement explains what Ruby versions support collection of each measurement.
Lastly, in order to capture GC timings, you'll need to enable GC::Profiler in your application.
To view data about the performance of your Ruby VMs. Log into New Relic, click APM, then select an app and go to Monitoring > Ruby VMs. This page appears only if your application uses Ruby agent version 3.8.0 or higher.
Most of these metrics help understand the behavior of Ruby's garbage collector.
Not all metrics can be collected across all Ruby versions. In general, you'll get the most complete data if you're on the most recent version of MRI. The list below explains exactly what's available where:
By default, data from all processes reporting into a given application name in New Relic will be combined on the Ruby VM page in the user interface. This means that if you have both web and background processes (such as Resque, Sidekiq, DelayedJob, etc.) reporting into the same New Relic application, the data may be confusing.
There are two ways to work around this issue:
- Pull your web and background processes into separate applications in New Relic, by setting the
app_nameconfiguration setting, or the
- Disable the collection of Ruby VM metrics in your background processes, by setting
disable_vm_sampler: truein your configuration file, or by setting
NEW_RELIC_DISABLE_VM_SAMPLER=1in your application's environment.
Additional documentation resources include:
- The APM Summary page discusses features and drill-down details when in the UI.
- The Transactions page shows a summary of your app's performance.
- The Ruby agent configuration resource contains update procedures and configuration file values, including general, proxy, transaction traces, and error collector.