Microsoft Windows Azure Development Cookbook — Save 50%
Over 80 advanced recipes for developing scalable services with the Windows Azure platform with this Microsoft Azure book and eBook
A Windows Azure hosted service may comprise multiple instances of multiple roles. These instances all run in a remote Windows Azure data center—typically 24*7. The ability to monitor these instances non-intrusively is essential both in detecting failure and in capacity planning.
However, there are times, especially early in the development process, when non-intrusive diagnostics monitoring is not sufficient. In this article by Neil Mackenzie, author of Microsoft Windows Azure Development Cookbook, we will see the benefits of intrusive monitoring of a Windows Azure role instance using IntelliTrace.
|Read more about this book|
(For more resources on this subject, see here.)
Windows Azure Diagnostics provides non-intrusive support for diagnosing problems with a Windows Azure hosted service. This non-intrusion is vital in a production service. However, when developing a hosted service, it may be worthwhile to get access to additional diagnostics information even at the cost of intruding on the service.
The Visual Studio 2010 Ultimate Edition supports the use of IntelliTrace with an application deployed to the cloud. This can be particularly helpful when dealing with problems, such as missing assemblies. It also allows for the easy identification and diagnosis of exceptions. Note that IntelliTrace has a significant impact on the performance of a hosted service. Consequently, it should never be used in a production environment and, in practice, should only be used when needed during development.
IntelliTrace is configured when the application package is published. This configuration includes specifying the events to trace and identifying the modules and processes for which IntelliTrace should not capture data. For example, the Storage Client module is removed by default from IntelliTrace since otherwise, storage exceptions could occur due to timeouts.
Once the application package has been deployed, the Windows Azure Compute node in the Visual Studio Server Explorer indicates the Windows Azure hosted service, roles, and instances which are capturing IntelliTrace data. From the instance level in this node, a request can be made to download the current IntelliTrace log. This lists:
- System info
The threads section provides information about when particular threads were running. The exceptions list specifies the exceptions that occurred, and provides the call stack when they occurred. The system info section provides general information about the instance, such as number of processors and total memory. The modules section lists the loaded assemblies.
The IntelliTrace logs will probably survive an instance crash, but they will not survive if the virtual machine is moved due to excessive failure. The instance must be running for Visual Studio to be able to download the IntelliTrace logs.
In this recipe, we will learn how to use IntelliTrace to identify problems with an application deployed to a hosted service in the cloud.
Only Visual Studio Ultimate Edition supports the use of IntelliTrace with an application deployed to a hosted service in the cloud.
How to do it...
We are going to use IntelliTrace to investigate an application deployed to a hosted service in the cloud. We do this as follows:
The first few steps occur before the application package is deployed to the cloud:
- Use Visual Studio 2010 Ultimate Edition to build a Windows Azure project.
- Right click on the Solution and select Publish....
- Select Enable IntelliTrace for .Net 4 roles.
- Click on Settings... and make any changes desired to the IntelliTrace settings for modules excluded, and so on.
- Click on OK to continue the deployment of the application package.
The remaining steps occur after the package has been deployed and the hosted service is in the Ready (that is, running) state:
- Open the Server Explorer in Visual Studio.
- On the Windows Azure Compute node, right click on an instance node and select View IntelliTrace logs.
- Investigate the downloaded logs, looking at exceptions and their call stacks, and so on.
- Right click on individual lines of code in a code file and select Search For This Line In IntelliTrace.
- Select one of the located uses and step through the code from the line.
How it works...
Steps 1 through 5 are a normal application package deployment except for the IntelliTrace configuration.
In steps 6 and 7, we use Server Explorer to access and download the IntelliTrace logs. Note that we can refresh the logs through additional requests to View IntelliTrace logs.
In steps 8 through 10, we look at various aspects of the downloaded IntelliTrace logs.
- Windows Azure Diagnostics: Initializing the Configuration and Using a Configuration File [Article]
- Digging into Windows Azure Diagnostics [Article]
- Managing Azure Hosted Services with the Service Management API [Article]
- Autoscaling with the Windows Azure Service Management REST API [Article]
- Using the Windows Azure Platform PowerShell Cmdlets [Article]
|Over 80 advanced recipes for developing scalable services with the Windows Azure platform with this Microsoft Azure book and eBook|
eBook Price: £18.99
Book Price: £30.99
About the Author :
Neil Mackenzie has worked with computers for nearly three decades. He started his computer career doing large-scale numerical simulations for scientific research and business planning. Since then, he has been involved primarily in healthcare software, developing electronic medical records systems. He has been using Windows Azure since PDC 2008 and has used nearly all parts of the Windows Azure platform – including those that no longer exist. Neil is very active in the online Windows Azure community – in particular, helping to solve many of the questions raised in the MSDN Windows Azure Forums. He is a Microsoft MVP for Windows Azure.