New Relic RPM is a Ruby performance management system, developed by New Relic, Inc (www.newrelic.com). RPM provides you with deep information about the performance of your Ruby on Rails or Merb application as it runs in production. The New Relic Agent is dual-purposed as a either a Rails plugin or a Gem, hosted on github.
The New Relic Agent runs in one of two modes:
Low overhead instrumentation that captures detailed information on your application running in production and transmits them to rpm.newrelic.com where you can monitor them in real time.
A Rack middleware that maps /newrelic to an application for showing detailed performance metrics on a page by page basis. Installed automatically in Rails applications.
Ruby 1.8.6, 1.8.7 or 1.9.1, including REE
JRuby 1.3 minimum
Rails 1.2.6 or later for Production Mode
Rails 2.2 or later for Developer Mode
Merb 1.0 or later
Any Rack based framework should work but may not be tested. Install RPM as a gem and add the Developer Mode middleware if desired. Report any problems to email@example.com.
You can also monitor non-web applications. Refer to the “Other Environments” section under “Getting Started”.
Install the RPM agent as a gem. If you are using Rails you can install the gem as a plug-in–details below.
gem install newrelic_rpm
To monitor your applications in production, create an account at newrelic.com/get-RPM.html. There you can sign up for a free Lite account or one of our paid subscriptions.
Once you receive the welcome e-mail with a license key and newrelic.yml file, copy the newrelic.yml file into your app config directory.
All agent configuration is done in the newrelic.yml file. This file is by default read from the config directory of the application root and is subsequently searched for in the application root directory, and then in a ~/.newrelic directory
You can install the agent as a Gem:
Add the following line to your Gemfile:
For Rails 2.x without Bundler:
edit environment.rb and add to the initalizer block:
To monitor a merb app install the newrelic_rpm gem and add
to your init.rb file.
To use RPM with a Sinatra app, add
in your Sinatra app, below the Sinatra require directive.
Then make sure you set RACK_ENV to the environment corresponding to the configuration definitions in the newrelic.yml file; i.e., development, staging, production, etc.
To use Developer Mode in Sinatra, add NewRelic::Rack::DeveloperMode to the middleware stack. See the config.ru sample below.
You can use RPM to monitor any Ruby application. Add
to your startup sequence and then manually start the agent using
To instrument Rack based applications, refer to the docs in NewRelic::Agent::Instrumentation::Rack.
Refer to the docs in NewRelic for details on how to monitor other web frameworks, background jobs, and daemons.
Also, see if your environment is already supported by the rpm_contrib gem.
When running the RPM Developer Mode, the RPM Agent will track the performance of every HTTP request serviced by your application, and store in memory this information for the last 100 HTTP transactions.
To view this performance information, including detailed SQL statement analysis, open /newrelic in your web application. For instance if you are running mongrel or thin on port 3000, enter the following into your browser:
Developer Mode is only initialized if the developer_mode setting in the newrelic.yml file is set to true. By default, it is turned off in all environments but development.
Developer Mode is available automatically in Rails Applications based on Rails 2.3 and later. No additional configuration is required.
For earlier versions of Rails that support Rack, you can use a config.ru as below.
Developer Mode is available for any Rack based application such as Sinatra by installing the NewRelic::Rack::DeveloperMode middleware. This middleware passes all requests that do not start with /newrelic.
Here's an example entry for Developer Mode in a config.ru file:
require 'new_relic/rack_app' use NewRelic::Rack::DeveloperMode
When your application runs in the production environment, the New Relic agent runs in production mode. It connects to the New Relic RPM service and sends deep performance data to the RPM service for your analysis. To view this data, log in to rpm.newrelic.com.
NOTE: You must have a valid account and license key to view this data online. Refer to instructions in *Getting Started*, below.
Reach out to us–and to fellow RPM users–at support.newrelic.com. There you'll find documentation, FAQs, and forums where you can submit suggestions and discuss RPM with New Relic staff and other users.
Find a bug? E-mail firstname.lastname@example.org, or post it to support.newrelic.com.
Thank you, and may your application scale to infinity plus one.
Lew Cirne, Founder and CEO<br/> New Relic, Inc.