views:

55

answers:

3

I am developing AMF Flash gateway on FlourineFx application for deployment on Windows Azure and I want to use Azure SQL.

I use NHibernate 2.1 + NHibernate.Linq 1.0 + FluentNHibernate 1.1

There will be two or more instances of this FlourineFx gateway and only 1 database.

I am planning on implementing memcached as 2nd level cache later (as Windows Azure WorkerRole), but is it necessary? (I don't mind performance, but I do mind consistency)

+2  A: 

I don't know if 2nd level cache solves some transaction-related problems or just makes it faster

The main point of the L2 cache is to avoid database hits and I wouldn't say that the L2 cache solves transactions-related problems; It might just be involved (and thus make the whole process a bit more complicated), if fully transactional caches are supported by NHibernate.

Personally, I tend to limit the use of L2 caching to read-only (or mostly read) objects, that's where the L2 cache gives all its power. Caching read-write entities is trickier, especially in a clustered environment, and the cache provider must support the Cache Concurrency Strategy required by your application for a given entity (read-only, non-strict-read-write, read-write).

I'm not sure this really answers the question, but at least it might give you some hints.

References

Pascal Thivent
Thanks. Seems that I want to use NHibernate.Caches.MemCache and CloudCache [http://cloudcache.codeplex.com] or Velocity [http://blogs.msdn.com/b/velocity]
Tomas Mirezko
+1  A: 

The cache won't help you with consistency. Of course it will help with performance, and you should use a distributed one, like memcached, if running multiple instances, as you correctly inferred.

That said, NHibernate does have features to help with consistency. Check:

Diego Mijelshon
A: 

No, you don't.

But, how you guys helped me point to the right direction, it will help with performance. So I will definitely run some instances of memcached and investigate concurrency control further.

Thanks.

Tomas Mirezko