Memcache is a popular open source caching solution that can boost the performance of repetitive database queries or API calls. It is a distributed in-memory cache, with server implementations are available for many operating systems.
Windows Azure supports the memcache wire protocol, making it easy for existing memcache applications to migrate to Windows Azure. When you use memcache on Windows Azure, you can also take advantage of Windows Azure caching 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.
Many popular OSS packages are often deployed with memcache, including Drupal, Joomla, Wordpress, PHPBB, and MediaWiki. All of these packages have been tested to verify that they will work well with memcache support in Windows Azure.
There are two approaches available for implementing memcache for a Windows Azure application: the server gateway approach, and the client shim approach. From a developer perspective, either approach supports the standard memcache API calls, so the only change needed is to point the application at the appropriate endpoint, and existing API calls will continue to work the same as if you had deployed your own memcached server.
The server gateway approach offers very simple deployment – you only need to open an additional internal endpoint in your cache cluster named memcache_default and then configure your application to use this endpoint. This approach has performance limitations in some scenarios, however, because memcache and Windows Azure Caching Service use different hashing algorithms, resulting in the need to re-hash keys to determine which server a key should be be stored on.
The client shim, on the other hand, is installed on the client application (which may be hosted on Windows Azure), and provides a memcache protocol handler for the application, with calls translated locally to Windows Azure Caching API calls which are sent to the cache servers. This results in better performance because there are no extra network hops for re-hashing keys, but deployment requires installation of the client shim on application roles, whereas the server gateway approach does not require any installation or setup steps on the client.
For more information about memcache support in Windows Azure, including details of how to deploy a memcache server gateway or memcache client shim for your application, see Memcached Wrapper for Windows Azure Caching (Preview) on the Windows Azure Developer Center.