Hosting Azure In-Role Cache on Dedicated Roles
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.
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|
In Visual Studio 2012, configure the virtual machine size and instance count in the Configuration tab of the role properties.
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.
In Solution Explorer, right-click the Azure project, and then select Add New Worker Role Project.
Select Cache Worker Role.
Optionally change the name, and then click Add.
In Solution Explorer, navigate to the Roles folder. Double-click the new role.
In the properties window, go to the Caching tab.
Verify that Enable Caching and Dedicated Role are selected.
Then configure the settings for the
defaultcache, or create new named caches.
Guidelines for a Dedicated Caching Topology
The following guidelines apply to the dedicated In-Role Cache topology:
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.
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.
Do not use a dedicated In-Role Cache role for other code or services.
Only one cache cluster is supported for each cloud service.