Azure Redis Cache – Improve performance using Clustering

Please go through the following articles to learn more about the basics of Azure Redis Cache

  1. Azure Redis Cache – Introduction
  2. Azure Redis Cache Configure Data Persistence
  3. Azure Redis Cache Enhanced Security And Network Isolation

Azure provides the three tiers, mentioned below for Azure Redis Cache.

  1. Basic
  2. Standard
  3. Premium

Premium tier provides multiple additional features. In this article, we will learn how to improve the performance of the Azure Redis cache endpoint by configuring the clustering to the Azure Redis Cache service.

Introduction:

When you create an Azure Redis Cache, azure provides you a node that serves the requests with limited number of requests per second. Sometimes, the performance levels of the default configuring might not be sufficient. So, you would need to scale out the Azure Redis Cache. We can enable the scaling and high availability of Azure Redis Cache by configuring Clusters. Let’s see how to enable cluster for Azure Redis Cache.

Navigate to the Azure Management portal and go to Azure Redis Cache. Click on Add as shown in the below screen capture.

0_cachelisting

You will be taken to the New Redis Cache blade, as shown below. You must choose one of the available Premium Tiers. In this example, I have selected P1 Premium tier. Once you select the required tier, click Select.

2_selectpremium

You must choose one of the available Premium Tiers. In this example, I have selected P1 Premium tier. Once you select the required tier, click Select.

3_choosecluster

Clicking on the Redis Cluster in the New Redis Cache blade, you will be taken to the Redis Cluster blade as shown in the above screen capture where you can choose the number of shards.

By default, the Azure Redis Cache would be provisioned with 1 shard. You can choose up to 10 shards as of this writing.

For this example, In the above screen capture, as my selected tier is Premium tier 6 GB, when I choose 2 shards, I get 12 GB of storage for storing the data.

For Premium P1 tier, the maximum size of the cache is 60 GB (10 Shards * 6 GB per shard). However, in case if you think 60 GB is not sufficing, then you have to choose higher Premium tier depending on your requirements. The maximum size that you would get as of this writing is 530 GB in Premium P4 tier.

Also, note that each shard is a set of two instances primary / replica pair. We will discuss more about the shard and it’s features at the end of the article.

Once you choose the required number of shards, click OK in the Redis Cluster blade and then click on Create button in the New Redis Cache blade.

As shown in the below screen capture, we have successfully created the Azure Redis Cache.

6_cachelisting

In case you would like to increase the memory size after you created the Azure Redis Cache, you can do that by using one of the preview features named Redis Cluster Size as shown below.

4_increasecluster

Clicking on the Redis Cluster Size blade you will be taken to the following.

5_increaseshard

As shown in the above screen capture, increase the Shard Count based on your requirement and click on OK to update the cluster size.

Azure Redis Cache – Cluster Architecture

7_clusterarchitecture

Below are the details about the above diagram.

  • The above diagram is a cluster with Shard count 3 which we have configured for our Azure Redis Cache in this example.
  • Each node in the cluster has two instances
    • First one is the primary instance – This is the one that is used for serving the requests.
    • Second one is the replica of the primary instance. – In case if the Primary instance is not healthy, the second one – replica will be used automatically.
  • Each node in the cluster is highly available. In case if there is a problem with the primary node, automatically the replica would be promoted as the primary instance.
  • Azure automatically handles the part of data sync between the two instances within each node.

Summary:

In this article, we have learnt the following.

  • Configure Clusters for Azure Redis Cache while creating a new Azure Redis Cache
  • Increase the cluster size to an existing Azure Redis Cache.
  • Azure Redis Cluster Architecture

Hope you enjoyed reading the article. Your feedback is appreciated.

Leave a comment