This course teaches you how to manage application and network services in the Azure ecosystem.
By the end of this course, you'll have gained a firm understanding of the key components that comprise the Azure application and network services ecosystem. Ideally, you will achieve the following learning objectives:
- How to use Active Directory.
- How to understand networking strategies for Azure and communication services.
- How to use Redis cache.
This course is intended for individuals who wish to pursue the Azure 70-532 certification.
You should have work experience with Azure and general cloud computing knowledge.
This Course Includes
- 1 hour and 10 minutes of high-definition video.
- Expert-led instruction and exploration of important concepts surrounding Azure application and network services.
What You Will Learn
- How to utilize Azure Active Directory.
- How to implement Azure communication strategies.
- How to take advantage of Redis caching.
Hello and welcome back to the final section of managing applications and network services. In this section, we will cover the topic of caching. We'll first discuss the Redis Cache; a modern and preferred approach to implementing caching and secondly we'll look at migrating from Azure Managed Cache Service to Redis. As the Azure Managed Cache Service is due to be retired in November, 2016.
Redis Cache is a popular Open source, high performance, in memory data structure store which can be used as a database, cache or a message broker. Redis Cache provides more than just a typical value store including data structures such as strings, hashes, lists, sets and sorted sets whilst also supporting transactions and atomic operations. Redis also provides features such as replication, partitioning and high availability.
Let's go to the Azure portal now and see how we can create a Redis Cache. Before we look at this example it's worth nothing that some familiarity with the Dot Net stack exchange Redis API is a required knowledge for the certification path. And you can expect to be tested on some parts of it at a level similar at what we've looked at here. Connecting to a Redis Cache is done through the connection multiplexer which requires our Redis connection string.
Having created our connection multiplexer object we call get database to get a reference to our Redis database. Starting with a simple string set operation we provide a key invalid persist in our database. The second line shows a similar example but demonstrates some of the additional perimeters we can specify such as an expiry time; that defines when the value will be evicted from the cache and the behavior of this operation. In this case we have to find the when argument as a not exists. Meaning that the string will be set only if an entry with a matching key doesn't already exist. The third line demonstrates that we can pass other value types directly, without casting them as strings.
In this example, we're setting an integer as the value. In fact we can install any serializable type. The next line shows us the retrieving value is the simplest calling, the self explanatory string get method. This call will not error if the value doesn't exist but will instead return a special nil value. We can check whether the value exists by checking the has value property on the return value.
Remember the Redis Cache is not just a key value store. Next lines demonstrates some of the rich operations available to us. We can call string length to get the length of the string without having to pull down the entire string to the client. This is particularly useful if the string in the Redis Cache is larger. It saves us time and bandwidth required to download the string to our client. It's worth noting here the calling string length when the value is not a string will result in an error. This reminds us that Redis is type aware and not just a repository of strings.
The next two lines called string decrement and string increment as you can guess this requires the corresponding value to be an integer. Calling string decrement or increment without any additional arguments increments or decrements the integer value by one. This further highlights the efficiency benefits of the richer features of Redis Cache. As we are able to manipulate the cache values without having to pull down the current value, perform our operation and send the new value back to the server again. It's also worth noting that we don't need to check whether the key we're using exists first as Redis will create the key and set the value to zero if it doesn't exist and only then perform our increment or decrement operation. And lastly, a simple string append example which as you can guess, appends our specified string to the end of the existing string. Again we don't need to check whether the key already exists as Redis will set the value to an empty string if the key doesn't exist before invoking a string append operation.
We now discuss the Azure Managed Cache Service in the context of migrating to Redis. As we have mentioned, the Managed Cache Service is due to be retired in November 2016. With many solutions utilizing the Managed Cache Service it's important to be aware of the migration path to Redis. In most cases, migration can be achieved with minimal code and configuration changes depending on the features used. In many cases, the APIs are similar or can be adapted with minimal effort.
The first step to a successful migration is understanding the Managed Cache Service features in use and how they map to the Redis Cache features. We won't cover the feature mapping details here as this is fairly extensive and details can change over time. We therefore suggest consulting the latest marks of guidance in the matter by searching available materials on the internet.
The URL provided here, provides such guidance with feature mapping information. Having to find our feature mapping we can create our Redis Cache, choosing an appropriate tier to provide the required volume of storage and other features such as clustering, number of connections, SLA and network bandwidth. Starting point is to pick the size that matches the existing Managed Cache Service size. Having created our Redis Cache we need to update existing clients. This usually involves removing references to manage cache service packages and replacing them with Redis packages and then making the required amends to the code.
Lastly if you're using Managed Cache Service for ADP.NET Session State and Output cache you will want to similarly immigrate at this point porting the corresponding issue of Redis Cache providers. Carrying out these high level steps will help achieve a smooth transition to Redis Cache. And this concludes to final section of this course.
We covered the topic of Redis Cache. Creating a cache and the Dot Net usage example utilizing StackExchange.Redis. And lastly, we discusses the high level steps for migrating from Azure Managed Cache Service to Redis. We hope you enjoyed this course in preparation for your 7532; Developing Microsoft Azure Solutions exam. And we hope to be a part of your future training endeavors.
Isaac has been using Microsoft Azure for several years now, working across the various aspects of the service for a variety of customers and systems. He’s a Microsoft MVP and a Microsoft Azure Insider, as well as a proponent of functional programming, in particular F#. As a software developer by trade, he’s a big fan of platform services that allow developers to focus on delivering business value.