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 created using Azure Redis Cache is accessible from any application within Microsoft Azure.
Definition reference: https://docs.microsoft.com/en-us/azure/redis-cache/
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 cases 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 (Please refer this (http://www.c-sharpcorner.com/UploadFile/225740/introduction-of-session-in-Asp-Net/ ) article for more details about In-Proc sessions) to store the logged in User Ids.
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 (please refer http://www.c-sharpcorner.com/UploadFile/225740/introduction-of-session-in-Asp-Net/ for more details about SQL Server mode for storing the session). 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 Azure Redis Cache for storing your application specific session related information in an external secured and reliable storage.
Below are few of the advantages of storing your sessions in the Azure Redis Cache.
- You can make your sessions available across all the web servers 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 data in a distributed way using Azure Redis Cache. Azure Redis Cache could 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 it’s features.
Login to Azure Management Portal and select Redis Cache as shown in the below screen capture.
Clicking on the Redis Cache, you will be taken to the following New Redis Cache blade where you provide the details for creating the Azure Redis Cache.
Choose the tier based on your requirements. Click on Select button of the Choose your pricing tier blade and then click on Create button of the New Redis Cache blade.
That’s it. We have created the Azure Redis Cache with the Basic tier.
Let’s review the different tiers available along with the features.
|Size||250 MB – 53 GB||250 MB – 53 GB||6 GB – 530 GB|
|Maximum number of Client connections||20,000||20,000||40,000|
|Scale Out to multiple Cache units||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.
In this article, we have learnt the following.
- A Basic use case of where we could use Azure Redis Cache.
- Different pricing tiers and its basic features.
- 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.