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.

4 comments

Reply

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

Exclusive Content

Measuring Agile in the Enterprise: 5 Success Factors for Large-Scale Agile Adoption

Michael Mah analyzes the development process in 5 companies: 2 Agile (one of them BMC) and 3 classic. He presents the factors which contributed to the success of BMC's Agile adoption.

Tom Preston-Werner on Powerset, GitHub, Ruby and Erlang

In this interview filmed at RubyFringe 2008, Tom Preston-Werner talks about how both Powerset and GitHub use Ruby and Erlang, as well as tools like Fuzed, god, and more.

David Laribee on Alt.NET and its Mission

David Laribee discusses the purpose of ALT.NET, its mission and future.

Discover RailsKits and Stop Writing Redundant Code

Ruby on Rails has become a popular Ruby framework for creating web applications in recent years. An aspect of creating a web application is the need to repeatedly create the same base functionality.

A Formal Performance Tuning Methodology: Wait-Based Tuning

Steven Haines talks about tackling web application performance tuning by proposing a method called wait-based tuning.

Shaw and Fowler About Forging a New Alliance

Shaw and Fowler talk about the need for a new relationship between the business department and the IT department. Studies have shown that projects mostly fail due to miscommunication between the two.

How to GET a Cup of Coffee

In this article, Jim Webber, Savas Parastatidis and Ian Robinson show how to drive an application's flow through the use of hypermedia in a RESTful application.

Archaeopteryx: A Ruby MIDI Generator

Eccentric artist turned overnight anti-celebrity, Giles Bowkett captures the heart and soul of RubyFringe as he demonstrates his revolutionary Archaeopteryx MIDI drum pattern generator.