Azure Redis Cache – Introduction

Microsoft Azure Redis Cache is based on the popular open source Redis Cache. It gives you access to a secure, dedicated Redis Cache, managed by Microsoft. A cache is created, using Azure Redis Cache, which is accessible from any Application within Microsoft Azure.

Definition reference https://docs.microsoft.com/en-us/azure/redis-cache/

Introduction

The usage of Redis Cache could be treated as an advanced approach of storing or caching application data that is available across distributed systems. Before learning more about Redis Cache, let us discuss a very basic use case that most of the Web Developers follow as a method of storing application specific data.

Traditional Way of Storing Sessions in a Load Balancing Environment

Let’s say, you are working on a Web Application which has some secured pages (Say administrator module or Registered module). In order to implement Security (Authentication and authorization), the basic method is to use Sessions (or cookies) and store the logged in user Id or role in the sessions. In this scenario, you would go for In-Proc sessions. Kindly refer to the Introduction To ASP.NET Sessions article for more details about In-Proc sessions) to store the logged in User Id's.

This method would work great for most of the basic Applications. However, for scalability reasons, if you decide to go for Load Balancing across multiple Web Servers; the way you handle your (In-Proc) sessions wouldn’t work. For this, you might have to go for SQL Server Mode. Storing sessions in SQL Server works great in a Web Farm (Load Balancing Environment). However, there are certain concerns like Performance, Storage space etc.

Advanced and Distributed way of storing sessions in a Load Balancing Environment- As explained in the Introduction section of this article, you can use AzureRedis Cache to store your Application specific session related information in an external secured and reliable storage.

Below are few of the advantages of storing your sessions in Azure Redis Cache.

  • You can make your sessions available across all the Web Servers, which are hosted in a Web Farm.
  • You can configure High availability and Disaster recovery (which we will discuss in upcoming articles) for your Application specific session data.

Please note that storing Session Data is just a basic example of storing the data in a distributed way, using Azure Redis Cache. Azure Redis Cache can be used for many other purposes. We can discuss about them in our upcoming articles.

Let’s now see how to create Azure Redis Cache along with the different tiers available, as of this writing and its features.

Login to Azure Management portal and select Redis Cache, as shown below.

Azure

By clicking Redis Cache, you will be taken to the following New Redis Cacheblade, where you provide the details for creating Azure Redis Cache.

Azure

That’s it. We have created Azure Redis Cache with the basic tier.

Azure

Let’s review the different tiers, which are available along with the features.

  Basic Standard Premium
Cache YES YES YES
SLA NO 99.9% 99.9%
Size 250 MB – 53 GB 250 MB – 53 GB 6 GB – 530 GB
Maximum number of Client connections 20,000 20,000 40,000
Azure VNet No No YES
Scale Out to multiple Cache units NO NO YES
Persistence Storage NO NO YES

Please have a look at one of my previous articles Azure App Service: Sessions Management in Load Balancing Environment Using Redis Cache on how to use Redis Cache in a Web Application.

Summary

In this article, we have learned the following.

  1. A basic use case, where we can use Azure Redis Cache.
  2. Different pricing tiers and their basic features.
  3. An example of how to use Azure Redis Cache.

Hope, you enjoyed reading the article. Your feedback is appreciated. You can read the original article here.


Similar Articles