InfoQ

News

Velocity: Microsoft's Distributed In-Memory Cache

Posted by Jonathan Allen on Jun 04, 2008

Community
Architecture,
.NET,
SOA
Topics
Enterprise Architecture ,
.NET Framework
Tags
Caching

Distributed in-memory caches have been rather popular over the last few years in everything from mainstream Java applications to the fringe languages like Erlang. Continuing its rather frantic efforts to catch up with technologies predominately found in the open source world, Microsoft has introduced its own distributed cache.

Velocity is a distributed cache designed specifically for the .NET platform. Many of the features will be recognizable to those familiar with other distributed in-memory caches. It is currently available as a community tech preview.

There are two types of clients for Velocity. Simple clients only know about a single cache server. If the requested object is not available on that cache server, the cache server will fetch it from the appropriate server. Routing clients are much more involved. They always know where a particular object lives so they can query that cache server directly. The performance impact of sending all of the cache location data to a routing client hasn't been discussed. In addition to the cache servers, both types of clients support a local cache option. This still requires checking the server for stale data, but should reduce network traffic when dealing with large cache objects.

For concurrency two options exist. With optimistic concurrency, the first update wins and any further updates to the now stale object will fail. With pessimistic locking, a lock handle is returned. Until unlocked, or the timeout expires, all attempts to gain a lock will fail. Failure to obtain a lock is a non-blocking operation.

Objects can be removed from the cache explicitly, via a expiration date, or whenever memory pressure is exceeded. This last method, known as eviction, uses a least recently used algorithm.

In addition to a key, objects may have a collection of tags associated with them. There are methods to retrieve one or all objects that match a list of tags.

While there is support for ASP.NET's Session model, that is only one of many uses Microsoft envisions. S Muralidhar writes,

Our support for ASP.NET is part of the integrated .NET platform story. Rest assured that we are not focusing exclusively on ASP.NET applications alone. As an example, we plan to integrate with plain .NET applications (windows service, for example) or  IIS applications that may not involve ASP.NET.

Now onto upcoming functionality. The current CTP features support for scale-out, local caching  and ASP.Net SessionState integration among many others. We have a full bag of work items we’re looking at for our subsequent CTPs and RTM – including support for availability, replicated caches, notifications, better management support etc.

Push-based notifications is a request we’ve heard from many folks. This is certainly an area we’re looking very deeply into. While our current CTP does not have this support, this is very likely to be remedied in our upcoming releases. In the interim, if you’re using Velocity with a local cache, we have some workarounds for this with APIs like GetIfVersionMismatch() to help deal with potentially stale/out-of-date objects in the local cache. (You will need to use a combination of Get() and GetIfVersionMismatch() to get the right behavior)

Support for more advanced techniques is also planned. Anil Nori adds,

> As applications start using the caches for data access, I also believe, they will demand richer data services like query, transactions, analytics, synchronization etc. For example, we believe .NET applications will require LINQ queries on the distributed cache, the same way they query the backend SQL Server database. We envision “Velocity” becoming such a comprehensive distributed caching platform.

Coherence.NET by Cameron Purdy Posted Jun 4, 2008 6:18 PM
better late than never by peter lin Posted Jun 4, 2008 6:45 PM
Confusing with Apache Velocity! by Khaled Habiburahman Posted Jun 10, 2008 11:47 PM
NCache (free Express Edition now) by Iqbal Khan Posted Oct 7, 2008 6:02 PM
  1. Back to top

    Coherence.NET

    Jun 4, 2008 6:18 PM by Cameron Purdy

    .. Continuing its rather frantic efforts to catch up with technologies predominately found in the open source world ..


    According to David Campbell, a Microsoft Technical Fellow, interviewed by eWeek:

    Velocity is most like Oracle's Tangosol [Coherence] technology, Campbell said. Oracle acquired Tangosol last year. Tangosol's Coherence product, now subsumed into Oracle simply as Tangosol, provides a proven, reliable in-memory data-grid technology designed to meet the new demands for real-time data analytics, compute intensive middleware and high-performance transactions—often referred to as XTP (Extreme Transaction Processing). [..] "Tangosol is probably the closest in terms of what it'll [Velocity] look like," Campbell said.



    If you look at the Velocity API, you'll see that it's based closely on the Coherence API. That should give any Velocity users a clear upgrade path ;-)



    Peace,



    Cameron Purdy

    Oracle Coherence: Data Grid for Java, .NET and C++

  2. Back to top

    better late than never

    Jun 4, 2008 6:45 PM by peter lin

    funny it took microsoft so long. I'm gonna guess it will take a few years before it is comparable to gigaspace and coherence.

  3. Back to top

    Confusing with Apache Velocity!

    Jun 10, 2008 11:47 PM by Khaled Habiburahman

    It looks good but confuses me with Apache Velocity!, I think it would have been better if they have chosen a unique name in order to avoid confusion.

  4. Back to top

    NCache (free Express Edition now)

    Oct 7, 2008 6:02 PM by Iqbal Khan

    Velocity CTP1 leaves much to be desires and CTP2 is only making a marginal effort at catching up. I believe it will be some before Velocity as a product is stable enough to be taken seriously.

    In the meantime, NCache provides all the features for .NET applications already. Check it out at www.alachisoft.com. NCache Express is totally free and good for 2-server clusters. NCache Enterprise is the enterprise level distributed caching solution.

    Iqbal Khan

    Alachisoft

    www.alachisoft.com

Educational Content

Brian Marick on 4 Challenges and 5 Guiding Values of Agile Software Development

Brian Marick takes us through a quick tour of the most important values and challenges to adopting Agile successfully (they aren't the typical challenges and values we hear in the community).

Are You a Software Architect?

The line between development and architecture is tricky. Does it exist at all? Is an ivory tower actually needed? There's a balance in the middle, but how do you move from developer to architect?

Agile – A Way of Life and Pragmatic Use of Authority

The word 'authority' sometimes produces an allergic response in hard-line agilists. Freedom and authority – both are bad if misused and both are good if used in right spirit for a noble cause.

Getting Started with Grails, Second Edition

"Getting Started with Grails" brings you up to speed on this modern web framework. Companies as varied as LinkedIn, Wired, and Taco Bell are all using Grails. Are you ready to get started as well?

Using ITIL V3 as a Foundation for SOA Governance

Those familiar with only ITIL V2 often scoff at the thought that ITIL could serve as a governance framework for SOA. With ITIL V3, the focus of the framework shifted towards service-orientation.

Adrian Colyer on AspectJ, tc Server and dm Server

SpringSource CTO Adrian Colyer discusses AspectJ, SpringSource's dm Server and tc Server products, OSGi and Scrum.

Adam Wiggins on Heroku

Heroku's Adam Wiggins talks about Rails, Background Jobs, Add-Ons, Ruby, and how Heroku manages to work around Ruby's inefficiencies using Erlang and other languages.

SOA as an Architectural Pattern: Best Practices in Software Architecture

For Grady Booch the foundation of a good architecture is patterns, SOA being just one of many patterns. In this Second Life presentation, Booch attempts to bring more clarity on what architecture is.