Share via


Hosting Azure In-Role Cache on Dedicated Roles

Important

Microsoft recommends all new developments use Azure Redis Cache. For current documentation and guidance on choosing an Azure Cache offering, see Which Azure Cache offering is right for me?

This topic covers the dedicated In-Role Cache topology. This feature applies to role-based In-Role Cache.

For a downloadable sample that uses a dedicated topology, see Caching API and Performance Sample.

Understanding Dedicated In-Role Cache

A dedicated caching role is used only for caching.

Note

Dedicated role caching is only supported on worker roles and cannot be configured on web roles.

Although each virtual machine instance is dedicated to caching, some of the memory must be available to the operating system and other operating overheads. The following table lists the different virtual machine sizes, the physical memory on each. To understand the number of instances required for your caching requirements, see Capacity Planning Considerations for Azure In-Role Cache.

Virtual Machine Size Total Memory

Small

1.75 GB

Medium

3.5 GB

Large

7 GB

ExtraLarge

14 GB

In Visual Studio 2012, configure the virtual machine size and instance count in the Configuration tab of the role properties.

Warning

It is not supported to use the ExtraSmall virtual machine size.

To Use Dedicated In-Role Cache on a Worker Role

The following steps describe how to add a dedicated In-Role Cache worker role in an existing Azure project in Visual Studio 2012.

  1. In Solution Explorer, right-click the Azure project, and then select Add New Worker Role Project.

  2. Select Cache Worker Role.

  3. Optionally change the name, and then click Add.

  4. In Solution Explorer, navigate to the Roles folder. Double-click the new role.

  5. In the properties window, go to the Caching tab.

  6. Verify that Enable Caching and Dedicated Role are selected.

    Caching Dedicated Properties

  7. Then configure the settings for the default cache, or create new named caches.

Guidelines for a Dedicated Caching Topology

The following guidelines apply to the dedicated In-Role Cache topology:

  1. In general, a dedicated In-Role Cache role provides the best performance, because it does not share the role's virtual machine with any other application services. It also provides the most flexibility, because you can scale the In-Role Cache role independently. For these reasons, using a dedicated topology is the recommended caching architecture. However, there are situations where a co-located topology works well. For more information, see Guidelines for a Co-located Caching Topology.

  2. The amount of memory available per running role instance is determined by the virtual machine size (VM size) and the memory used by the operating system and other application services running on the role. To understand how to correctly set the Cache Size (%), see Capacity Planning Considerations for Azure In-Role Cache.

  3. Do not use a dedicated In-Role Cache role for other code or services.

  4. Only one cache cluster is supported for each cloud service.

See Also

Concepts

Hosting Azure In-Role Cache on Existing Roles
About In-Role Cache for Azure Cache

Other Resources

How to Use Azure In-Role Cache