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

X-Ray Vision into Your Azure Apps

08.22.2012
| 3858 views |
  • submit to reddit

The content of this article was originally written by Nick Floyd over at the New Relic blog.

At New Relic, we’ve always been interested in helping organizations and developers make great apps that perform ridiculously well. And developers who use Windows Azure with New Relic can make great, easy to deploy apps and have ‘x-ray’ vision into what those apps are doing.

So, what are some of the questions these technologies are trying to solve? Given that our applications behave more like ecosystems, we as developers need tools to help us create, maintain and manage those ecosystems. Windows Azure and the New Relic agent are two perfect tools to do just that. Below I talk about how you can begin using New Relic on Azure, as well as go over why you would want to use this technology to better understand what your software is doing in that environment.

Simple To Use & Set Up
It’s incredibly simple to set up New Relic to begin monitoring your applications:

1. Login to your Azure account and go to the Windows Azure Marketplace.
2. Click Sign Up and fill out the form to create your New Relic account.
3. Go to http://nuget.org/packages/NewRelicWindowsAzure.
4. Install the nuget-package “Install-Package NewRelicWindowsAzure”.
5. When prompted, key in the license key you received after the install.
6. Deploy your application with the New Relic agent to your Azure instance.
7. Go to rpm.newrelic.com and login to see the new metrics for your Azure application.

You can also watch me walk through the process in the video over at the original post.

How Does the New Relic Agent Work?
The .NET Common Language Runtime (CLR) is responsible for loading .NET assemblies into memory. The assemblies are composed of the Microsoft Intermediate Language (MSIL), a processor-independent format. When the CLR loads an assembly, it calls a Just-In-Time (JIT) compiler to build the MSIL bytes into native-code instructions (e.g., 80×86 instructions which are then executed by the CPU).

Code run by the CLR is considered ‘managed’ code, i.e., the CLR provides a managed environment in which memory object garbage collection and other services are ‘managed’ by the CLR. The Profiler API provides a mechanism for a profiler, such as the New Relic .NET agent, to inject code into whatever managed-code functions it desires. These injected bytes are in the form of MSIL, the .NET assembly language.

The point in time at which a method is ‘instrumented’ with our MSIL byte code is just prior to when the JIT compiler compiles the byte code into native instructions. The bytecode injection only occurs once for each assembly and is cached by the CLR.

Once the application is instrumented this way, the agent communicates periodically with something we call the collector. The collector sends metric and error data to it based on rules and configurations that are setup when installing the New Relic agent.

For Real User Monitoring (RUM), the application communicates with a New Relic application called the beacon through the use of Javascript.

RUM

New Relic Measures Your User’s Real Experience
One of the biggest challenges we have as developers is to answer the question: How do I know what my user’s experience is like? We know how the app performs locally and we have our own experience in production.

Having a tool to tell you how your users are experiencing your app and where they are experiencing it from is ideal for avoiding user frustration and optimizing your infrastructure. New Relic’s RUM feature helps you see what your users are experiencing from your server’s metal to your user’s web browser. You can even see geographically where the requests are coming from so that you can make better decisions about how to geographically disperse your Azure instances.

New Relic graphs

New Relic Helps You Find Performance Problems Easily
There is always that one transaction, database query, a missing index or n+1 that can bring a server down or hurt performance across the board in our applications. The good thing is that a cloud service, like Azure, let’s us spin up new instances based on demand and usage.

However when bad code gets out into production, we want to find it and fix it fast. New Relic allows you to dig into queries via explain plans or find a bad iteration right away once your application is instrumented. You can even do transaction traces on specific pages in your application to find out if database queries are needlessly being called.

Transaction Traces screenshot

New Relic Notifies You Before Things Go Down
One of the most compelling aspects of the cloud models Infrastructure-as-a-Service (IaaS), Platform-as-a-Service (PaaS) and Software-as-a-Service (SaaS) is that for the most part it is available from almost anywhere. Even when your software is down, generally these external services will be up.

Windows Azure provides a nice service dashboard that you can subscribe to via RSS that lets you know the health status of the Windows Azure Platform. But what if you wanted to know how healthy your application is or if it is ‘reachable’ from the outside? New Relic offers configurable notifications that can be used to let developers and sysadmins know if the site is ‘available’ to outside users, Apdex scores which help them understand user satisfaction, and error alert thresholds to tell them how ‘healthy’ the app is when used.

Customizing Your Alerting Thresholds screenshot

New Relic Reports on SLA and Scalability
Sometimes as developers we need to provide details on uptime, app performance, how many requests are being made to and through our software, and so on. These things are often used to inform the business on “how the site is doing,” or if “we are getting a good return on the investment we’ve made in the software we provide”.

Developers and infrastructure specialists are also concerned with scalability and sustainability. Often times we need to plan for expenses related to spinning up new nodes. Windows Azure gives us the tools to answer many of our scalability needs and even helps us monitor our logs and data stores.

As far as delivering SLA reporting and analysis tools, New Relic provides a wealth of information easily so that you can provide it to the business or schedule when to spin up new nodes in your Azure cloud to meet customer demand.

Scalability Analysis screenshot

I could go on and on about how these services have helped me and how they can help you, but I recommend you just try them for yourself.

All Windows Azure customers can get New Relic Standard for free, so now is the perfect time for you to try it out.

 

 

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.)