Guest Post: Getting Started with New Relic on Windows Azure
Editor’s Note: Today’s guest post comes from Nick Floyd, Senior Engineer at New Relic, which provides all-in-one web application performance tool that lets companies see performance from the end user experience, through servers, and down to the line of application code.
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 Windows 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 Set Up & Use
It’s incredibly simple to set up New Relic to begin monitoring your applications:
- Login to your Windows Azure account and go to the Windows Azure Marketplace.
- Click Sign Up and fill out the form to create your New Relic account.
- Go to http://nuget.org/packages/NewRelicWindowsAzure.
- Install the nuget-package “Install-Package NewRelicWindowsAzure”.
- When prompted, key in the license key you received after the install.
- Deploy your application with the New Relic agent to your Windows Azure instance.
- Go to rpm.newrelic.com and login to see the new metrics for your Windows Azure application.
You can also watch me walk through the process in this video:
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.
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 Windows Azure instances.
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 Windows 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.
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 Windows Azure. 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.
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 Windows Azure cloud to meet customer demand.
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.