Saturday, November 05, 2011

Caching for .NET Apps

The goal ... find a simple distributed cache that can be used by a .NET enterprise app, supports the storage of large objects, and will result in no additional cost to the client. We don't care about cache notifications, and it's OK (but not desirable) to incur the cost of serialization from native .NET objects to XML strings.

Memcached for Windows is here. I used the Linux version at Citadel for our new multi-asset trading platform, and it was fairly easy to use, except it doesn't support the enumeration of cached objects.

A management console GUI for Memcached is here.

It has been over 2 years since I considered Microsoft Velocity (see past blog entries here). However, it seems that Microsoft's Velocity Cache has been put into the Azure AppFabric, and the client is not considering the cloud at this time. Does anyone know if you can use Velocity (and the new Azure Service Bus) independent of Azure?

It seems that the new System.Runtime.Caching namespace in .NET 4 doesn't support distributed caching.

There is a project on Codeplex called SharedCache, but it looks like it has not been updated in a while. In addition, some of the comments seem to indicate that it hogs the CPU.

NCache has a free version.

Has anyone used any other solution? So far, it looks like NCache or Memcached is the way to go.


©2011 Marc Adler - All Rights Reserved. All opinions here are personal, and have no relation to my employer.

3 comments:

nielsb said...

Marc,
(You may get this comment twice - had problems with signing in).
AppFabric comes in two flavors; AppFabric for Azure and AppFabric Windows Server. So you should be able to use Velocity, (sorry, I still think about it as Velocity), without the cloud.

Niels

marc said...

Thanks very much, Niels.

The Service Bus also looks interesting. I wonder if it can be used as a Tibco/RabbitMQ replacement for lightweight messaging.

James Webster said...

You might want to reconsider NCache. Back in the day, there were accusations flying around that it was a blatant rip-off of Tangosol (before they were bought by Oracle) Coherence.

You might also consider Ehcache (Java). There is a server component that exposes a REST over HTTP interface to the cache. I started to implement a .Net wrapper that provided an extension of the System.Runtime.Caching classes, but haven't progressed it further lately... I might revisit that work soon.