Which Azure Caching Strategy to use?
I have been working on Azure for quite sometime now. I thought I would share my thoughts on how a developer can build something without spending a huge amount of money. Even if you are a company, it always helps to be as cost effective as you can.
Caching is important to scale any application. And Azure offers several different ways of caching. I have experimented with all types. All of them work quite well, but not all of them are cost effective as the others. It can hurt because you pay the costs monthly - every month.
The Azure Caching Service which you can configure in different amounts from 128MB to several GB works very well and is quite resilient, but it is not as fast as the Role based Caching. It is quite expensive to use it, because not only do you pay for it, but your own role memory may not be used that much.
However, using role based caching has its own cons. The first being that it does not support high availability atleast as per the current documentation. Also, it requires your roles to be small instances. That can be quite expensive if you have using extra small instances so far, and now have to make all of them small instances.
Hence, co-located cache within your instances may not be the best idea unless you already run small instances, in which case, good for you - you have a lot of money to spend!
Now, what you can do, is to use the dedicated cache role and make just that a small instance, and keep the rest as extra small instances. This way, you are using just what you really need to use, without spending an extra dollar on anything else. You can still scale easily on demand. The cache role will give you 1.75GB of RAM which is quite a large amount for less memory.
Do note that if you already use small instances, then it is a no brainer to use co-located caching with it. However, if you use my strategy an interesting thing to remember is that in most data centers, servers use less CPU in any case, it is memory which is heavily utilized, and this way you can add just more cache memory as you require, without adding CPU + memory, where you may not even use that CPU.
Caching is important to scale any application. And Azure offers several different ways of caching. I have experimented with all types. All of them work quite well, but not all of them are cost effective as the others. It can hurt because you pay the costs monthly - every month.
The Azure Caching Service which you can configure in different amounts from 128MB to several GB works very well and is quite resilient, but it is not as fast as the Role based Caching. It is quite expensive to use it, because not only do you pay for it, but your own role memory may not be used that much.
However, using role based caching has its own cons. The first being that it does not support high availability atleast as per the current documentation. Also, it requires your roles to be small instances. That can be quite expensive if you have using extra small instances so far, and now have to make all of them small instances.
Hence, co-located cache within your instances may not be the best idea unless you already run small instances, in which case, good for you - you have a lot of money to spend!
Now, what you can do, is to use the dedicated cache role and make just that a small instance, and keep the rest as extra small instances. This way, you are using just what you really need to use, without spending an extra dollar on anything else. You can still scale easily on demand. The cache role will give you 1.75GB of RAM which is quite a large amount for less memory.
Do note that if you already use small instances, then it is a no brainer to use co-located caching with it. However, if you use my strategy an interesting thing to remember is that in most data centers, servers use less CPU in any case, it is memory which is heavily utilized, and this way you can add just more cache memory as you require, without adding CPU + memory, where you may not even use that CPU.
Comments
Post a Comment