3 New Relic Power Features You Should Be Using Today

3 New Relic Power Features You Should Be Using Today

You already know that New Relic provides deep performance metrics for your Java, .NET, PHP, Python or Ruby application. But are you familiar with the power features that can bring your knowledge about your app to a new level? Don’t let the name fool you. While these features have serious power, they are easy to get started with. In this tutorial, I’ll get you up and running with three powerful New Relic features you should be using today.


Developer Mode

One of the most powerful features available to Ruby developers is Developer Mode.

Developer Mode gives you high visibility into the transactions being executing on your local development machine.

You’ll be able to immediately see in-depth transaction traces, including response times, individual method calls and SQL queries. Developer Mode jumps straight to the code block that is being executed, something you can’t do on the normal rpm.newrelic.com site.

Instead of talking about Developer Mode, let’s just dive in and take a look at it in action. After installing New Relic into your application, and clicking through a few actions, you’ll have a list of transactions to explore at http://localhost:3000/newrelic.

Click on one of the URLs in the list and you’ll get a Summary view of the entire request.

From this view, you can see every step in the request, from template rendering through the actual SQL time. In the example above, you can see that 53% of the request time was spent rendering the show.html.erb template. This is an excellent place to implement some fragment caching to speed up the request.

From the Detail view (as shown below), you can explore each step of the request, starting from the controller and action being called, through each additional method, template and SQL query. Clicking on a line like User#find_by_sql will take you to the exact line of code that made that method call (below, lower).

Finally, you can see every SQL query that a request makes by looking at the SQL view. From there, you can spot any duplicate SQL requests you might have made and go straight to the line of code that is creating it. Or, you can view detailed information about the statement to explore in-depth review of the query for information on the number of tables used, rows scanned and indexes accessed.

Having detailed performance information about your application, down to the line of code, is invaluable during development. The power of Developer Mode can really only be appreciated by using it, so, if you’d like, sign-up for a free 30-day Pro Account and give it a try.


Custom Metrics and Custom Dashboards

The New Relic agent collects a massive number of metrics about your application with very little effort, but knowing how an application is technically performing isn’t the whole picture. You need to know how your business metrics are performing in your application. Custom metrics, such as order value, login attempts and signups/registrations can all be collected within New Relic, and compared against the technical performance of your application.

Custom Metrics are available in all five of the supported languages: Java, .NET, PHP, Python and Ruby.

Below is an example of a custom metric using the Python agent, but the concepts are the same for the other languages.

As you can see in the example above, we’re sending one of two custom metrics whenever an order is processed. If the order succeeds, we send the dollar value of the order. Or if the order fails, we send a counter instead. Recording custom metrics like these can provide a deeper understanding of the impact that your application’s performance has on your business metrics. In the case of the failed orders, by using custom metrics, you can spot problems sooner when you spot a spike in the failing metrics (e.g., your payment processor is down).

You can use custom metrics for recording timing data as well. This is an excellent way to monitor the response time of an external service you depend on.

Custom metrics should always have a name that begins with Custom/* in order to avoid any namespace collisions with the native agent metrics. Once you have these custom metrics, you can get some real visibility by combining multiple native charts with charts of your custom metrics on a Custom Dashboard. If you aren’t already, you should start collecting the metrics that are critical to your business with a free 30-day Pro Account.


Scalability Analysis

It certainly would be nice to know if your app will be able to withstand a sudden surge in traffic before you actually hit the front page of Hacker News. But knowing which component of your application could be the bottleneck is hard. Will it be the application itself? Your database layer? Or maybe even the CPU utilization will be overwhelmed?

The final power feature you should be using today is the suite of Scalability Analysis reports that show you your app performance. In an ideal world, your application performance should hold fairly steady as the load increases throughout the day. You can see in the chart below that as the requests per minute (X-axis) increase, the application response time holds steady (Y-axis).

If, on the other hand, your app is not equipped to scale with increases in request, then you will see a chart with a steep slope like the one below. Here you can see that as the number of requests increases, the database response time also increases dramatically.

These types of trends are very difficult to spot without such rich visualization. Optimally, you want to see the response time grow fractionally with the increased requests. If you find that your application response time is growing geometrically with the increase, then it’s time to optimize. Since you never know when your application is going to need to scale, it’s important that you keep an eye on it’s scalability as it grows. Tools like the Scalability Analysis and Capacity Analysis reports are a great way to easily make performance monitoring part of your routine.

If you haven’t already, you can sign up for a free 30-day Pro Account at New Relic to try these and many more power features that will keep your application performing at its best.

Note: Want to add some source code? Type <pre><code> before it and </code></pre> after it. Find out more
  • http://blog.01tchat.com Peter

    Great tutorial!

  • Jon

    Awesome! Would love to see a similar tut for PHP.

  • http://developernetwork.info/ David D’hont

    Whoa, thanks a lot man. This is some really interesting stuff. I might try out the developer mode soon.

  • Jonathan

    Been trying out New Relic recently, and it really is an impressive product.

    My only issue with it is their pricing. From what I understand New Relic helps identify slow code/queries/pages etc. to help improve the user experience, but also reduce hosting costs. Maybe you don’t need a new server—maybe fixing a few poorly written SQL queries will do the same.

    At the same time, web server and hosting costs seem to just get cheaper. Is it worth paying $50/month for New Relic (or $25/month paid yearly), or would the money be better spent on a more powerful server?

    Just seems a little pricey for startups.

    • Eric Jain

      The pricing is a good deal if your machines (and software licenses) are expensive. If on the other hand you are running a lot of cheap machines (as many startups do), not so much.

      The other issue is that you can’t pay for the features you use, but need to get bundles (like cable TV). I can’t use half of the feature of my Standard subscription, but am told I should upgrade to a Pro subscription to use another (seemingly basic) feature I need…

      If I found another service that lets me monitor JVMs without too much fuss and that has better pricing, I’d drop New Relic in an instant.

  • http://www.maomuffy.com Mfawa Alfred Onen

    Great Tips, been trying newlic and they are imply awesome plus enjoying the free data nerd T-Shirt!

  • Ian

    Some useful tips with some equally useful examples. It’s good to see some of the finer details of web development get some coverage. Fine-tuning website/app performance isn’t one of the glamourous jobs and often gets overlooked but it can be crucial in identifying mis-configurations and potential bottlenecks. I’ve only experimented with New Relic in the past but these tips encourage me to take advantage of it’s capabilities a bit more. Thanks!

  • Guillaume

    New Relic is real dope, been using it in many project and it saves my life couple times while working on performance issue. Pro account is expensive though. I think it worth it when you are working on really large application which need performance tune up. Nice article. Cheers.

  • Peter

    Does New Relic sample data or collect all transactions?

  • http://noelcohen.webstarts.com/ RisaRichardson

    You have written an informative article with a lot of thought-provoking
    information. I agree with you on several points as they are valid and
    reasonable.

  • http://www.facebook.com/chris.legros.94 Chris Legros

    Great tutorial!
    http://www.01tchat.fr