Introducing Dragonfly Cloud! Learn More

Question: How can I scale Azure Redis Cache?


Azure Redis Cache is a powerful, highly available, and scalable solution for caching data in your applications. When it comes to scaling there are mainly two strategies that you can use: vertical scaling (scaling up or down) and horizontal scaling (sharding).

1. Vertical Scaling

This involves changing the tier or pricing model of your Azure Redis Cache instance. In terms of vertical scaling, you can scale up (increase capacity) or scale down (decrease capacity). This type of scaling is suitable when your workload increases or decreases significantly.

# Log into Azure az login # Scale up the cache size az redis update --name myCache --resource-group myResourceGroup --size P2

In the above PowerShell example, we're logging into Azure and then scaling up the Redis Cache named 'myCache' within the resource group 'myResourceGroup' to a premium P2 size.

2. Horizontal Scaling

Horizontal scaling, also known as sharding, involves adding more cache instances to manage increased load. Azure Redis Cache supports partitioning your data across multiple cache units with a feature called Redis Cluster. Each shard in the cluster holds a subset of your cached data.

To enable clustering, pass the --cluster-enabled flag when creating or updating your cache:

# Create a new clustered cache az redis create --name myClusteredCache --resource-group myResourceGroup --sku Premium --vm-size P2 --locations WestUS 0 --cluster-enabled # Update an existing cache to be clustered az redis update --name myExistingCache --resource-group myResourceGroup --cluster-enabled

Remember: Sharding with Redis Cluster involves splitting your data among multiple shards, which can complicate application logic. It might not be the right choice for every situation but can be very effective if properly implemented.

Please check the official Azure Documentation regularly as Azure updates features frequently.

Was this content helpful?

White Paper

Free System Design on AWS E-Book

Download this early release of O'Reilly's latest cloud infrastructure e-book: System Design on AWS.

Free System Design on AWS E-Book

Start building today 

Dragonfly is fully compatible with the Redis ecosystem and requires no code changes to implement.