Windows Azure Caching Service Hands on Experience

28/03/2014

For a while I have been looking for a reason to use the new Windows Azure Caching service, an in memory cache hosted by Microsoft.
Unfortunately, due to its price point starting at 100 dkk/month, for 128 MB it is not really feasible to use for my small private projects.

But the other day at work, I was asked to help one of our consultant teams improving their Azure solution, for a customer that had already prepaid lots of resources in windows azure that would just disappear if not used, so suddenly the price was not an issue.

Their challenge was that they had built a web site hosted by a web role in a cloud services that relied heavily on an in memory cache. They had built it around the HttpRuntime.Cache, but had some major performance issues when the cache was cold and had to be repopulated from a slow backend system. So, they were looking for a fast and low impact (code-wise) alternative to their current cache implementation. Windows Azure Caching Service seemed like a good fit, as the total need for caching was well within the 128 MB of the smallest plan.

Here is what I learned from helping them change their caching implementation.

We ended up not using the cache because of the size limitations, as it would require a lot of rewriting in the application to use the cache in a better way. So instead we ended up serializing the large lists of objects into azure blob storage, then read the data from there when the cache was cold. This turned out to perform fast, and in the end, it is a lot cheaper solution for the customer.

In retrospect, I wish they had designed their application differently, in terms of cache usage, but with the limited time we had to change things, I feel like the solution was great.