Memcache is a distributed, in-memory caching solution used to help speed up large scale web applications by taking pressure off the database. Memcache is used by many of the internet’s biggest websites and has been merged with other technologies in innovative ways.
Windows Azure supports the Memcache protocol to enable customers with existing Memcache implementations to easily migrate to Windows Azure. If an application already uses Memcache, there is no necessity to replace this code with new code.
If you are currently considering or actually have deployed to Windows Azure part of your infrastructure you might be wondering which route to go: Memcache or Azure Cache. The good thing here is that Azure Cache fully supports Memcache’s protocol so no need to rewrite code, etc. As I’ve mentioned in a previous article How to: Install Memcache for php and WordPress Memcache is the way to go in order to have a shared cache storage. If you have multiple servers that need to share a common store then this is the general way to go. Php supports session storage in Memcache and WordPress can store objects there. So the real question is which fits your needs better:
- Windows Azure Caching (currently in preview)
- Managed, multi-tenant shared cache
- Not free (see pricing)
- Quotas apply in terms of cache size.
- I would assume it is fully dedicated and faster than regular memory in a web service role // vm
- Support for large cache size (up to 150 gb last I checked)
- Windows Azure in-role cache
- Uses the free memory of your roles (so you don’t need to pay anything extra to use this)
- Dedicated to your cloud service (You cannot use with other services)
- You need Visual Studio’s Windows Azure SDK to use and configure this.
- You can deploy a VM to host memcache
- You incur the costs of the VM and you are limited by the performance of it (not sure how it compares that to the dedicated cache performance)
- You need to manage it.
So thus far it seems cost wise assuming performance is the same Memcache offers more attractive pricing although it comes with the pains of management, etc. I would assume for a large enterprise Windows Azure Cache is a better choice as it simplifies management, offers more features on top of the basic caching and supports up to 150gb of cache. Scaling should also be much simpler using Windows Azure Cache and it comes with support for .Net applications which is something not native for Memcache.
Running Windows Azure Caching with Memcache is a better option than, for example, running just Memcache itself in a worker role. This is because Windows Azure Caching offer value-added features such as graceful shutdown, high availability, local caching (on client shim), notifications (on client shim), data consistency, high availability (HA), and easy scale-up and scale-down that’s transparent to the clients, to name a few. For example, the server hashing scheme and partition management in Windows Azure Caching with Memcache help load balancing and preserve data consistency.
You can also read more on Capacity Planning for Windows Azure Cache Service (Preview).
So really as you can read Microsoft is pushing their cache service as a superior version of memcache which might find a lot of value in the enterprise while individuals might gravitate more towards Memcache due to lower costs. And I also continue to believe that Windows Azure Cache must have higher performance than say memory in your VM or in a Web Worker Role (As there is a like a factor of 2 in the pricing). But then again there might be a lot of value out there I am not seeing.