NHibernate Azure AppFabric Cache

1.2k Views Asked by At

Has anyone tried using the NHibernate Velocity L2 cache provider against the Azure AppFabric Cache? If so, what did you discover?

On a side note, we're using SQL Azure to store our data.

2

There are 2 best solutions below

1
On BEST ANSWER

The latest release "Windows Azure Caching (Preview)" should help you - http://social.msdn.microsoft.com/Forums/en-US/windowsazuredata/thread/9a2dbd9f-1b9d-4249-a48b-216d9dfdc2bc

You have support for Notifications, improved latencies, greater flexibility and pricing only based on Compute cost of the VMs you configure with.

0
On

Our use case for caching is listed as follows:

  1. We want to speed up our web application by caching frequently accessed SQL Azure data.
  2. The cache should be enabled by simply editing the NHibernate config (just like any other NHibernate L2 cache).
  3. When an update is made to one of these entities on an Azure role instance, the change should immediately propagate to the other Azure instances.
  4. We would like to avoid the hassle of setting up and managing something like memcached.

Unfortunately, the current state of the Azure AppFabric Cache doesn't suit our needs. Here's why:

After tweaking the NHibernate Velocity provider, we were able to cache objects in the distributed cache, but there was a small delay (~1second) when accessing each entity. Because we were trying to access hundreds of cached objects per web request, each HTTP request was actually slower than if we accessed the DB directly - certainly not what we were looking for.

We tried to fix this issue by enabling the AppFabric local cache. The performance was drastically improved, but this raised another problem. Once an object is stored in the local cache, it will stay there until it expires (you can set an expiration timespan for the cache). At this point, there isn't much difference between the AppFabric local cache and the NHibernate SysCache provider (which makes use of the ASP.NET Cache), except that you have to pay extra for the AppFabric cache.

If the Azure AppFabric local cache supported notifications like its Windows Server AppFabric cousin, we'd be happily using the Azure cache. Please vote for this feature at www.mygreatwindowsazureidea.com.

For reference, a co-worker posted a question on the Azure forums concerning the use of the AppFabric local cache.

If anyone discovers that MS has enabled local cache notifications on Azure, please post an answer to my original question.