InfoQ

News

Velocity: Microsoft's Distributed In-Memory Cache

Posted by Jonathan Allen on Jun 04, 2008 04:38 PM

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 http://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
    http://www.alachisoft.com

Educational Content

Bindings, Platforms, and Innovation

This presentation focuses on the Internet and separating myth from fact, history from the future, and the mundane from the imaginative. Bob Frankston presents a vision of what could and should be.

Orchestrating Long Running Activities with JBoss / JBPM

This article explores the use of JBoss and jBPM to implement design solutions that effectively address the issue of orchestrating long running activities.

Neo4j - The Benefits of Graph Databases

This presentation covers the use of graph databases as an optimal solution for data that is difficult to fit in static tables, rapidly evolving data or data that has a lot of optional attributes.

Realistic about Risk: Software development with Real Options

This session introduces Real Options and shows how it can help in running your project. Real Options is a decision-making process that can be used to manage risk.

Communication Flexibility Using Bindings

This article discusses the use of bindings on services and references (including the instance of non-configured bindings) as the means to implement SCA communications in a Web and SOA environment.

Writing DSLs in Groovy

After a short introduction to DSLs, Scott Davis plays with the keyboard showing how to approach the creation of a DSL by typing working snippets of Groovy code that get executed.

Scaling Agile with C/ALM (Collaborative Application Lifecycle Management)

IBM Rational and InfoQ present, Scaling Agile with C/ALM, an eBook showing organizations how to become “finely tuned software delivery machines” by enabling team integration and scaling.

Concurrent Programming with Microsoft F#

Amanda Laucher presents a real life enterprise application written in F#. She shows actual code snippets, explaining design decisions and suggesting how to use some of the F# constructs.