Windows Azure - Profiling

In the previous articles we have seen a way of logging information and publishing in Windows Azure. In this article we can experiment on Profiling.

Why we need Profiling?

Profiling is needed for performance measurement of an application. In the runtime we can see the real load on hardware:

  • CPU
  • Memory
  • Hard Disk etc.

For example, if the CPU load is 100% on 10 user requests, then we are sure that the application needs to be load balance when 100 user requests are expected. Otherwise the application performance will be reduced due to request processing delay.

In the case of an Azure application we can decide on adding more instances of the web role or worker role based on performance information.

Pre-Requisites

This article requires knowledge of publishing azure applications using Visual Studio IDE. You can get the complete article here.

Steps

Please follow the steps to experiment Profiling for Windows Azure applications.

Step 1: Create a Worker Role

Create a new worker role and modify the Run() method as following.

public override void Run()
{
   
// This is a sample worker implementation. Replace with your logic.
    Trace.WriteLine("$projectname$ entry point called", "Information");

    while (true)
    {
       
List<string> list = new List<string>();

        for (int i = 1; i <= 1000; i++)
        {
            list.Add(
"Item" + i.ToString());
        }

        list.Sort();
    }
}


Step 2: Publish with Profiling

Now we need to publish the application to Windows Azure with Profiling enabled. Right click on the Azure project and choose the option Publish.

WinAzrPrl1.gif

Select the subscription in the first page and click Next to continue. In the next page use Advanced Settings and select the Enable profiling option as shown below.

WinAzrPrl2.gif

After entering the details click the Publish button. Wait for a few minutes for the deployment to be finished.

WinAzrPrl3.gif

Step 3: View Profiling Report

For viewing the information, we can use the Server Explorer window in Visual Studio. From the Server Explorer window select Windows Azure Compute item. Right click on it and click on the Add Deployment Environment item.

WinAzrPrl4.gif

In the appearing dialog select the environment to which the deployment was done.

WinAzrPrl5.gif

Now select the View Profiling Report from the Server Explorer > Worker Role > Instance.

WinAzrPrl6.gif

You can see a new item is queued in the Activity Log as shown below.

WinAzrPrl7.gif

Once the Status is completed you can see the CPU Graph as shown below. In our example the CPU is clocking 100% utilization.

WinAzrPrl8.gif

So this concludes the article on Profiling. We can profile more information like:

  • Instrumentation
  • .NET Memory Allocation
  • Concurrency

After the test please ensure to delete the deployment from the Azure platform.

Reference

http://msdn.microsoft.com/en-us/library/windowsazure/hh369930.aspx

Summary

In this article we have seen how to profile an application using Windows Azure. The attached source code contains the application we have discussed.