Azure Managed Redis
A very fast in-memory store for caching, sessions and leaderboards.
Redis keeps data in memory, so reading it takes well under a millisecond. Apps use it to remember answers they've already worked out (a cache), so they don't ask the database again and again.
Azure Managed Redis is Microsoft's managed Redis service. It replaces the older Azure Cache for Redis, which is being retired, so new projects should start on Azure Managed Redis.
Cost. Billed by the hour from the moment it exists. Even the smallest size is roughly 15 USD to 50 USD a month, depending on the tier, so it's left as reading.
Use it when
- the same database queries run thousands of times and the database is struggling.
- a web app on several servers needs to share signed-in users' sessions.
- you need fast counters, leaderboards or short-lived data that expires by itself.
How it works
- Cache-aside
- The app looks in Redis first. If the answer isn't there, it reads the database and saves the answer in Redis for next time.
- Expiry
- Each key can have a time to live, after which Redis removes it, so the cache doesn't go stale for ever.
- Eviction
- When memory is full, Redis drops keys by a policy, such as the least recently used ones.
- Persistence
- Optionally saves a copy to disk, so data survives a restart. Many caches don't need it.
Options
- Memory Optimized
- Most memory for the price, for large caches with little work per request.
- Balanced
- A middle option for most apps.
- Compute Optimized
- More processing power, for very busy workloads.
- Flash Optimized
- Keeps less-used data on fast disks to hold very large data sets for less.
Example. Larkfield Group's booking site showed the same room list to every visitor, straight from SQL. Caching it in Redis for 60 seconds cut database load by 90%, and pages loaded twice as fast.
Don't confuse it with
- Cosmos DB
- A database meant to keep your data permanently. Redis is mostly for fast, temporary copies.
- Azure Front Door caching
- Caches whole web responses at the edge. Redis caches data inside your app.
Words to know
- Cache
- A fast copy of data that's slow or expensive to fetch.
- TTL
- Time to live: how long a key stays before it expires.
- Cache hit
- The answer was in the cache. A cache miss means it wasn't.
Where to look
- Home
- Azure Managed Redis
- + Create
Practise it
- Add app settings and watch the logsHow-to, Free
- Create an Azure SQL database with the free offerHow-to, Free tier
Read it in the guide, next to the tasks and labs.
Open in Azure Portal, Hands On