About ClientDiagnosticLevel for Azure Managed Cache Service

Note

For guidance on choosing the right Azure Cache offering for your application, see Which Azure Cache offering is right for me?.

Managed Cache Service client applications are configured for diagnostic data collection using a diagnostic level. This diagnostic level provides a single setting for configuring the level of data collection. This topic provides an overview of troubleshooting steps and diagnostics for troubleshooting Managed Cache Service applications.

Important

In the Managed Cache Service release, the ClientDiagnosticLevel and related client steps described in this topic apply only for role-based cloud service cache clients.

Troubleshooting and Diagnostics for Managed Cache Service Applications

Applications running on Azure are widely distributed, multi-instance applications that can be hard to debug. These types of applications require more than standard tools and approaches to troubleshooting. Troubleshooting Azure applications is beyond the scope of this topic, but more information is available in Diagnostics and Debugging in Azure.

Configuring Managed Cache Service applications to collect diagnostic data for troubleshooting requires configuring the diagnostic level and configuring the cache diagnostics during role startup. This topic provides an overview of these steps for Managed Cache Service applications.

  • Configure the Client Diagnostic Level

  • Configure Cache Diagnostics during Role Startup

  • Performance Counters by Diagnostic Level

Configure the Client Diagnostic Level

Managed Cache Service provides five client diagnostic levels which are used to configure the amount of diagnostic data collection. Diagnostic levels range from 0 to 4, and the number indicates the volume of diagnostic information collected for cache servers and clients. Each diagnostic level contains a pre-configured set of performance counters, event logs, tracing, and crash dump settings that can be used to monitor the health of your Managed Cache Service application.

Client Diagnostic Level Diagnostic Data Collected

0

Very critical/catastrophic server logs only.

1

Diagnostic data that helps in assessing usage patterns, health of the cache system, and any potential errors. This is the default configuration level.

2

Diagnostic data at fine grain granularity of all requests and important system information.

3

Diagnostic data with more verboseness and system information.

4

Highest verbosity logs for all requests and system information.

There are two types of caching diagnostic levels that correspond to cache client and cache server diagnostics. DiagnosticLevel represents cache server diagnostics, and ClientDiagnosticLevel represents cache client diagnostics. Each level configures a different set of performance counters, logs, traces, and crash dump settings. These diagnostic levels are configured in the ServiceConfiguration.cscfg file for the application, and may be changed for a running cloud application simply by deploying an updated ServiceConfiguration.cscfg file.

The ClientDiagnosticLevel level for a cache client is specified in the ServiceConfiguration.cscfg, in the configuration section for the role that is the cache client. This setting is added by the Managed Cache Service NuGet package when the role is configured to act as a cache client.

Note

For more information about configuring cache clients using the Managed Cache Service NuGet package, see How to: Configure a Cache Client for Azure Managed Cache Service.

The default ClientDiagnosticLevel is 1, and if no ClientDiagnosticLevel is present for the role then a ClientDiagnosticLevel of 1 is used. To change the ClientDiagnosticLevel, modify the ClientDiagnosticLevel setting for the role in ServiceConfiguration.cscfg. The following example is the WebRole1 section from a ServiceConfiguration.cscfg file with a ClientDiagnosticLevel of 1.

<Role name="WebRole1">
  <Instances count="1" />
  <ConfigurationSettings>
    <!-- Other settings omitted for clarity... -->
    <Setting name="Microsoft.WindowsAzure.Plugins.Caching.ClientDiagnosticLevel" value="1" />
  </ConfigurationSettings>
</Role>

The following table lists the diagnostic data that is collected for each of the client diagnostic levels.

Note

Crash dump settings for the client diagnostic levels are relevant only to cache clients using the Memcache client shim. Crash dumps are not collected for non-Memcache clients. For more information about the Memcache client shim, see Run your Memcache app with Azure Managed Cache Service.

ClientDiagnosticLevel Data Collected

0

  • Log Level: Critical

  • No Performance Counters

  • No Event Logs registered

  • Mini Crash Dumps

1

2

3

4

Note

When running Managed Cache Service client applications in the Azure emulator, the traces for all role instances are collected under the *_IN_0 folder, even when there are multiple role instances. This behavior is by design. When Managed Cache Service applications are hosted in Azure, the traces for each client role instance are located in the respective folders for the role instances.

Configure Cache Diagnostics during Role Startup

To start the collection of caching diagnostic data, the following code must be invoked during role startup. This code must be added to each role that is a cache client or cache server in order for caching diagnostic data to be collected. One convenient place to host this code is in the role's OnStart override, as demonstrated in the following example.

public override bool OnStart()
{
    DiagnosticMonitorConfiguration dmConfig = 
        DiagnosticMonitor.GetDefaultInitialConfiguration();

    // Configure the collection of cache diagnostic data.
    CacheDiagnostics.ConfigureDiagnostics(dmConfig);

    DiagnosticMonitor.Start("Microsoft.WindowsAzure.Plugins.Diagnostics.ConnectionString", 
        dmConfig);

    return base.OnStart();
}
Public Overrides Function OnStart() As Boolean

    ' Existing OnStart override code omitted for clarity.

    Dim dmConfig As DiagnosticMonitorConfiguration = _
        DiagnosticMonitor.GetDefaultInitialConfiguration()

    ' Configure the collection of cache diagnostic data.
    CacheDiagnostics.ConfigureDiagnostics(dmConfig)

    DiagnosticMonitor.Start("Microsoft.WindowsAzure.Plugins.Diagnostics.ConnectionString", _
        dmConfig)

    Return MyBase.OnStart()

End Function

The O:Microsoft.ApplicationServer.Caching.AzureCommon.CacheDiagnostics.ConfigureDiagnostics method configures the collection of caching diagnostic data. If this method is not called, caching diagnostic data is not collected. To use the CacheDiagnostics class, add a reference to Microsoft.ApplicationServer.Caching.AzureCommon.dll located in C:\Program Files\Microsoft SDKs\Azure\.NET SDK\[Current SDK Version]\ref\Caching, and add the following using (or Imports) statement.

using Microsoft.ApplicationServer.Caching.AzureCommon;
Imports Microsoft.ApplicationServer.Caching.AzureCommon

Note

If the role has been configured as a cache client using the Managed Cache Service NuGet package, then the Microsoft.ApplicationServer.Caching.AzureCommon.dll assembly reference is already added.

If you are adding caching to an existing role and diagnostic configuration code is already present, you can add the call to O:Microsoft.ApplicationServer.Caching.AzureCommon.CacheDiagnostics.ConfigureDiagnostics to the existing diagnostic startup code before the call to O:Microsoft.WindowsAzure.Diagnostics.DiagnosticMonitor.Start.

Warning

Calling both O:Microsoft.ApplicationServer.Caching.AzureCommon.CacheDiagnostics.ConfigureDiagnostics and O:Microsoft.WindowsAzure.Diagnostics.DiagnosticMonitor.Start is required for diagnostic data collection in Managed Cache Service applications. If both of these methods are not called during role startup, caching diagnostic data is not collected.

Performance Counters by Diagnostic Level

The following sections contain lists of the performance counters included in each of the server and client diagnostic levels. Both Managed Cache Service and performance counters are included. For a complete list with descriptions of the Managed Cache Service performance counters, see Monitor Azure Managed Cache Service. For more information about the performance counters, see Performance Counters in the .NET Framework.

  • Client Diagnostic Level 1 Performance Counters

  • Client Diagnostic Level 2, 3, and 4 Performance Counters

Client Diagnostic Level 1 Performance Counters

ClientDiagnosticLevel 1 contains the following performance counters.

  • \Azure Caching:Client Host\Failure Exceptions

  • \Azure Caching:Client Host\Total Local Cache Hits

  • \Azure Caching:Client Host\Current Server Connections

  • \Azure Caching:Client Host\Average Get Latency / operation Microsecond

  • \Azure Caching:Client Host\Average Put Latency / operation Microsecond

  • \Azure Caching:Client Host\Retry Exceptions

  • \Azure Caching:Client Host\Timeout Exceptions

  • \Azure Caching:Client Host\Requests

  • \Processor(_Total)\% Processor Time

  • \.NET CLR Memory(_Global_)\% Time in GC

  • \Azure Caching:Client(*)\Failure Exceptions

  • \Azure Caching:Client(*)\Total Local Cache Hits

  • \Azure Caching:Client(*)\Current Server Connections

  • \Azure Caching:Client(*)\Average Get Latency / operation Microsecond

  • \Azure Caching:Client(*)\Average Put Latency / operation Microsecond

  • \Azure Caching:Client(*)\Retry Exceptions

  • \Azure Caching:Client(*)\Timeout Exceptions

  • \Azure Caching:Client(*)\Requests

Client Diagnostic Level 2, 3, and 4 Performance Counters

ClientDiagnosticLevel 2, 3, and 4 contain the following performance counters.

  • \Azure Caching:Client Host\Requests

  • \Azure Caching:Client Host\Requests / sec

  • \Azure Caching:Client Host\Server Responses Dropped / sec

  • \Azure Caching:Client Host\Failure Exceptions

  • \Azure Caching:Client Host\Failure Exceptions / sec

  • \Azure Caching:Client Host\Average Get Latency / operation Microsecond

  • \Azure Caching:Client Host\Average Put Latency / operation Microsecond

  • \Azure Caching:Client Host\Average Get Latency (Network) / operation Microsecond

  • \Azure Caching:Client Host\Read Requests

  • \Azure Caching:Client Host\Write Requests

  • \Azure Caching:Client Host\Bytes Received / sec

  • \Azure Caching:Client Host\Bytes Sent / sec

  • \Azure Caching:Client Host\Current Server Connections

  • \Azure Caching:Client Host\Local Cache Filled Percentage

  • \Azure Caching:Client Host\Local Cache Hits Percentage

  • \Azure Caching:Client Host\Total Local Cache Hits

  • \Azure Caching:Client Host\Total Local Cache Objects

  • \Azure Caching:Client Host\Total Notifications Received

  • \Azure Caching:Client Host\Timeout Exceptions

  • \Azure Caching:Client Host\Timeout Exceptions / sec

  • \Azure Caching:Client Host\Retry Exceptions

  • \Azure Caching:Client Host\Retry Exceptions / sec

  • \Azure Caching:Client Host\Total Connection Requests Failed

  • \Azure Caching:Client Host\Network Exceptions

  • \Azure Caching:Client Host\Network Exceptions / sec

  • \Azure Caching:Client Host\Current Waiting Requests

  • \Processor(_Total)\% Processor Time

  • \.NET CLR Memory(_Global_)\% Time in GC

  • \Azure Caching:Client(*)\Requests

  • \Azure Caching:Client(*)\Requests / sec

  • \Azure Caching:Client(*)\Server Responses Dropped / sec

  • \Azure Caching:Client(*)\Failure Exceptions

  • \Azure Caching:Client(*)\Failure Exceptions / sec

  • \Azure Caching:Client(*)\Average Get Latency / operation Microsecond

  • \Azure Caching:Client(*)\Average Put Latency / operation Microsecond

  • \Azure Caching:Client(*)\Average Get Latency (Network) / operation Microsecond

  • \Azure Caching:Client(*)\Read Requests

  • \Azure Caching:Client(*)\Write Requests

  • \Azure Caching:Client(*)\Bytes Received / sec

  • \Azure Caching:Client(*)\Bytes Sent / sec

  • \Azure Caching:Client(*)\Current Server Connections

  • \Azure Caching:Client(*)\Local Cache Filled Percentage

  • \Azure Caching:Client(*)\Local Cache Hits Percentage

  • \Azure Caching:Client(*)\Total Local Cache Hits

  • \Azure Caching:Client(*)\Total Local Cache Objects

  • \Azure Caching:Client(*)\Total Notifications Received

  • \Azure Caching:Client(*)\Timeout Exceptions

  • \Azure Caching:Client(*)\Timeout Exceptions / sec

  • \Azure Caching:Client(*)\Retry Exceptions

  • \Azure Caching:Client(*)\Retry Exceptions / sec

  • \Azure Caching:Client(*)\Total Connection Requests Failed

  • \Azure Caching:Client(*)\Network Exceptions

  • \Azure Caching:Client(*)\Network Exceptions / sec

  • \Azure Caching:Client(*)\Current Waiting Requests

See Also

Reference

Microsoft.WindowsAzure.Diagnostics.DiagnosticMonitor

Concepts

Monitor Azure Managed Cache Service

Other Resources

Performance Counters in the .NET Framework
Diagnostics and Debugging in Azure