Microsoft Azure Service Profiler

How to Provision .NET 4.6.1 and Service Profiler Agent on a Service Fabric Cluster

This tutorial guides you to set up the Service Profiler agent on a Service Fabric cluster so that performance data can be collected for aggregation and analysis. Because Service Profiler requires at least .NET Framework 4.6.1, this tutorial will also provision the Service Fabric cluster with the latest version of .NET (currently 4.6.1).

For a more comprehensive guide to using Service Profiler, see the getting started tutorial.

WARNING: These tutorial steps are intrusive to running applications in the cluster since all VMs are updated and restarted concurrently (when installing .NET Framework).

Prerequisites

  1. A Service Fabric application published and running in a cluster.

Download Service Profiler’s Azure extension resource template for Service Fabric

  1. Sign into the Service Profiler website at https://www.azureserviceprofiler.com
  2. Once you’ve signed in, click your account name in the top-right corner, and choose Configure Data Cubes.

    Service Profiler Account Name

  3. Select (or create) the data cube you want to send performance data to. Ensure that the data cube has a valid storage connection string. If it does, skip to the next step; otherwise, do the following:

    • Enter a valid storage connection string in the Azure Storage connection string textbox.
    • Click Save Changes (you may need to scroll down to the bring this button into view).
  4. Click the Agent setup option Deploy Azure extension on Service Fabric cluster. This will open the Azure portal and begin the wizard to create a new resource template that will install .NET 4.6.1 and the Service Profiler agent on each of your cluster’s nodes. The resource template also includes a default agent configuration that will capture Reliable Actor events and send them to the data cube you selected. Note that Service Fabric doesn’t provide default ETW events for Reliable Services at this point, so some manual instrumentation is required if you want to profile Reliable Services or OWIN-based web services.

    Custom Deployment

  5. In the Custom deployment blade of the Azure portal, click the Template property. You will notice 3 main sections – below is a description of each section but you do not need to make any edits.

    The parameters section controls the virtual machines in the cluster that will be updated:

    {
      ...
      "parameters": {                                       
        ...
      },
    

    The variables secion contains the Service Profiler agent’s settings (e.g. the set of ETW events that will be analyzed, how often sampling occurs, etc):

      "variables" {                                         
      ...
      }
    

    The resources section defines the extensions that will be installed. The first runs a script that will upgrade the cluster to the latest version of the .NET Framework (currently 4.6.1):

      "resources": [
        {
          ...
          "tags": {
          "displayName": "CustomScriptExtensionInstallNet46"
          },
          ...
        },
        {
          ...
          "tags": {
            "displayName": "ServiceProfilerAgent"
          },
        }
      ]}
    
  6. In the Custom deployment blade, click Parameters, and edit values for the following parameters:

    • VmNamePrefix: This is the prefix of the VMs in your Service Fabric cluster. Tip: This would have been defined at the time you created your cluster - you can check by viewing your cluster’s resource group in the Azure portal and looking at the VMs that are part of the cluster. Each VM name will have the same prefix, followed by a unique number.
    • VmStartIndex: An integer value that represents the starting index of the cluster’s VM names. Default = 0 (older clusters may start at 1).
    • VmCount: the number of nodes (VMs) in the Service Fabric cluster.
    • SpDataCubeName: The name of the Service Profiler data cube.
    • SpStorageAccountName: The Azure storage account name for Service Profiler data. This will have been configured when you created the Service Profiler data cube.
    • SpStorageAccountKey: The Azure storage account key for Service Profiler data.
  7. Click OK

  8. Follow the rest of the wizard, specifying your cluster’s Resource group, Subscription, and Resource group location.

  9. Click Create. This action will now install 2 extensions on each VM node in your Service Fabric cluster: one for .NET 4.6 and the other for the Service Profiler agent. The operation can take up to 15 minutes to complete.

    WARNING: This script is intrusive to running applications in the cluster since all VMs are updated and restarted concurrently. Please only run this on a test cluster.

  10. To view extension deployment status:

    • In the Azure Portal, navigate to the Service Fabric cluster’s resource group. (View all resource groups here.)
    • In the Resource group blade, click Last deployment, and select the most recent deployment in the Deployment history blade.

    Last Deployment

  11. To view a specific VM’s installed extensions:

    • In the Azure Portal, navigate to the Service Fabric cluster’s resource group. (View all resource groups here.)
    • In the Resources list, select a VM.
    • Select Extensions in the VM’s Settings blade.

    VM Extensions

View Performance Data with Service Profiler

  1. First, confirm that the extension deployment succeeded (see step #8 of previous section)

  2. Confirm that the cluster is in good health – the Service Fabric Explorer is useful for this:

    • Navigate to the Service Fabric cluster in the Azure Portal
    • Click the link to launch Service Fabric Explorer.

    Service Fabric Explorer entry point

    Note: It can take several minutes for the cluster to regain its health since all nodes were affected with the .NET Framework upgrade.

  3. Once the cluster is stable, you should soon be able to view performance data in the Service Profiler web app. Navigate to the Data Cube you're sending data to. Remember, you can navigate directly by composing the following URL: /summary/<DataCubeName>. Or, sign into https://www.azureserviceprofiler.com, and click a Data Cube link.

    • Note: With the default agent settings, it can take up to 15 minutes for data to be sent, so you may need to check several times before you can see the first data that has streamed in.
    • For a quick way to see immediate data, select Custom as the time range and click Apply (by default, Custom is set to the last 59 minutes - for now, use this time range sparingly since it operates on unprocessed data, and therefore is more compute intensive on the Service Profiler analysis service.)
  4. Read about how to explore performance data here.

Additional Resources

Give feedback