Caching is not as easy as you think it is

For the past year I have been playing around with azure caching and learning a lot. I have got frustrated, confused and then finally there seems to be light at the end of the tunnel. This is what I've learnt from my experience so far:

1. I have no idea why they allow co-located caching because if you are having a decent sized cache with lots of reads and writes, this is unusable. Use dedicated cache role - only that can handle significant load.

2. Caching which uses BLOB storage as a persistence mechanism has problems if it accesses BLOB storage frequently because items are not remaining in the cache. I was flummoxed by this problem but worked around it because in my case, I was able to get away with checking for the existence of the BLOB which is much faster than trying to download it every time (my data just requires the existence check).

3. Don't be unhappy with your code if you have x-small and small instances and your sites with caching roles do not perform well. I found out that even with the best code even small roles may not perform well with cache sizes greater than 1.5gb on dedicated cache roles. I ended up with small web roles using a medium cache role and everything works fine.

4. BLOB storage performance is piss poor - at least at this point in time. Do not rely on it. My site really got slow for no reason but that BLOB storage is super slow if you do lots of writes to it, irrespective of the size of the BLOBs involved. To get around this problem eventually, I ended up queuing the writes to a Azure Queue and then writing to BLOB storage using a queue reader sequentially.

5. Don't store a key - list pair in cache or blob storage. Performance is too poor - use the table storage instead. Note the table name cannot contain "-". This seems to perform better when the size of the list gets larger and larger. 

Comments

Popular posts from this blog

Tutorial: Using Google Cloud Storage from C# and .NET

Late 2008 Macbook only giving 1.5 gb/s speed with 6 gb/s Intel SSD?

The ridiculous interview experience