2

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)

mizi_sk
  • 1,007
  • 7
  • 33
  • How would a L2 cache improve consistency of... of what by the way? – Pascal Thivent Sep 07 '10 at 08:31
  • consistency could not be the right word - I am worried about DB, what happens if there are connections from multiple instances of NHibernate. I don't know if 2nd level cache solves some transaction-related problems or just makes it faster (maybe this should be the question and hopefully I would tell myself what idiot I was) – mizi_sk Sep 07 '10 at 10:03

3 Answers3

2

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
  • 562,542
  • 136
  • 1,062
  • 1,124
  • Thanks. Seems that I want to use NHibernate.Caches.MemCache and CloudCache [http://cloudcache.codeplex.com] or Velocity [http://blogs.msdn.com/b/velocity] – mizi_sk Sep 07 '10 at 14:13
1

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
  • 52,548
  • 16
  • 116
  • 154
0

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.

mizi_sk
  • 1,007
  • 7
  • 33