Scaling ASP.NET Application just got easier with a new technology that Microsoft has just released that they have dubbed codename "Velocity". This product is still in the early stages of development, but it is meant as a direct competitor against memcached. If you are not familiar with memcached, here is how it is described in Wikipedia:
memcached (pronunciation: mem-cache-dee) is a general-purpose distributed memory caching system that was originally developed by Danga Interactive for LiveJournal, but is now used by many other sites. It is often used to speed up dynamic database-driven websites by caching data and objects in memory to reduce the number of times the database must be read. Memcached is distributed under a permissive free software license.
So basically it allows you to create a distributed memory cache across your server farm, that allows any computer in the server farm to access the data in the cache. So there is no more issues with storing session data on server farms, or worrying about setting up common SQL stores of temporary data. This is also very practical for reducing database stress on Web 2.0 sites, many of the top Web 2.0 sites use this to reduce reads on the database. The biggest user of memcached to date is Facebook. This diagram below gives a basic idea of how distributed caching works.
There have been many Open Source projects for getting memcached working on C#, and most have been pretty successful, but because memcached was designed for the UNIX environment, porting memcached to a Windows Service has always lagged behind the actual releases of the required libraries to get memcached working. Enter Velocity, as the Velocity team describes:
Velocity is intended to provide distributed caching (in memory) for all .NET applications – from enterprise scale to web-scale. We believe that there are many applications that need a distributed caching mechanism, and that there is, therefore, a need for distributed caching as a core part of the .NET platform. We expect to have more integrated support for this functionality with other parts of the .NET platform in our upcoming releases.
There is also a pretty nice Velocity writeup on MSDN that goes in depth about how Velocity works as well as providing some basic code examples on how to get data into and out of your Velocity Cache. The current set of features looks pretty nice, and I can't wait for Velocity to become more stable so I can introduce it in to the IdeaPipe mix.
Here is a breif overview of the Current Features:
- Support for different cache types, partitioned and local
- Support for different client types, simple and routing
- Load Balancing & Dynamic Scaling
- ASP.Net Integration, currently there is only a Session Provider
- Key and Tag based Access
And Beyond
- Availability - support for Failover when machines go down
- Replicated Cache - another cache type
- Embedded Topology - run the cache embedded within you application instead of as a cache service
- Notifications - Get notified when a object in the cache is updated
- Consistency Models - Support for both weak and strong consistency when doing reads/writes
- Native client access to the cache service (E.g - PHP, C++ etc)
- Manageability & Administration