Is Redis Cache the bee’s knees of cloud performance?
If you have a heavy foot and really want to put the pedal to the metal then you’ve got to get Redis Cache to hit that fast, high throughput, low latency sweet spot. Right?
This post compares the performance of the premium priced dedicated Redis Cache hosted on Azure against bang-for-your-buck, shared Azure Table Storage.
On paper it looks like we’ve brought a gun to a knife fight. Is it even worth comparing? Let’s find out.
Storage Pricing
Redis Cache stores data in memory and for a 1GB standard plan with low network performance, costs around US$103/mo.
Azure Table Storage stores unstructured NoSQL data on shared disks and for 1 GB storage costs around $US0.07/mo.
Local Caching vs Dedicated Caching
Why do you need Redis Cache? Can’t you just use .Net’s MemoryCache for local caching?
Local caching is often good enough but what happens when you need to scale out to handle more than normal workloads? Every front-end server would need to manage their own cache, which means lots of high-end servers that consume lots of memory. The server warm-up time may increase to load the initial data. You will need to ensure each cache doesn’t become stale and need updating. These problems can be avoided without caching by retrieving data directly from Azure Table Storage or using a dedicated Redis Cache.
Redis Cache vs Azure Table Storage Performance
I will run the experiment against addy.co.nz, an address autocomplete service for websites that finds and validates addresses while the user types against 2.6M+ NZ Postal Address File and LINZ records.
Once the user clicks on an address, detailed address information is retrieved from Azure Table storage. Fast and free access is available to the RESTful Address API.
The golden rules of performance evaluation will be applied. Isolate a resource. Measure it. Repeat and look for consistency.
Let’s have a look at the performance when retrieving 1,000 random addresses from Azure Table Storage and Redis Cache using single threaded and multi-threaded experiments. Each experiment will be executed 3 times.
Summary
The performance results indicate that Azure Table Storage and Redis Cache produce consistent results in single-threaded and multi-threaded tests. Both solutions appear to scale since there wasn’t a significant time difference to retrieve a single address compared to retrieving multiple addresses simultaneously.
Azure Table Storage is a shared resource and individual retrieval times were highly variable. However, running the experiment 3 times produced a similar average retrieval response time. It took on average 8.5 sec to retrieve 1,000 addresses.
Redis Cache performance is about twice as fast compared to Azure Table Storage and the retrieval times are highly consistent and predicable with a low standard deviation. It took on average 4.3 sec to retrieve 1,000 addresses.
So it is worth using Redish Cache to retrieve addresses and will it make a significant difference? Well, what is considered fast enough?
It might be hard to justify spending more money on hosting and adding another layer of complexity using the Cache-Aside pattern to improve an existing Azure Table Storage solution that retrieves addresses in 1/10 of a second which appears to be pretty snappy on a web browser. See for yourself.
Found this article this week while looking for caching on Azure for my website. Based on your test and analysis, Azure Table storage seems good enough for my case. However, from a video on channel9 (https://channel9.msdn.com/Shows/Web+Camps+TV/A-look-around-the-Redis-Cache-Preview-with-Saurabh-Pant from 49th min) Azure Table was way slower than Redis. Now I'm confused as both your tests and the channel 9 demo were simple queries, and in your case, there were 2.6M records while the channel 9 demo has only 1M records, hmmm~~
Love your article, I you are looking for Azure Redis Cache with WordPress then check this https://www.scientistz.com/2018/01/how-to-use-redis-cache-with-wordpress-on-azure/ I hope it will help.
Thanks Jay.