nHibernate strategies in a web farm

Posted by Pete Nelson on Stack Overflow See other posts from Stack Overflow or by Pete Nelson
Published on 2010-01-12T15:15:04Z Indexed on 2010/03/20 20:01 UTC
Read the original article Hit count: 501

Filed under:
|
|
|
|

Our current project at work is a new MVC web site that will use a WCF service primarily to access a 3rd party billing system via a web service as well as a small SQL database for user personalization. The WCF service uses nHibernate for the SQL database.

We'd like to implement some sort of web farm for load balancing as well as failover and maintenance. I'm trying to decide the best way to handle nHibernate's caching and database concurrency if there are multiple WCF services running.

Some scenarios I've been thinking about...

1) Multiple IIS servers, one WCF server. With this setup, the WCF server would be a single point of failure, but there would be no issues with nHibernate caching or database concurrency.

2) Multiple IIS servers, each with it's own WCF service. This removes a single point of failure, but now nHibernate on one machine would not know about database changes done by another machine.

Some solutions to number 2 would be to use an IStatelessSession so we're not doing any caching and nHibernate is always fetching directly from the database. This might be the most feasible as our personalization database has very few objects in it. I'm also considering a 2nd-level cache such as memcached or Velocity, but it may be overkill for this system.

I'm putting this out there to see if anyone has experience doing this sort of architecture and to get some ideas for a solution. Thanks!

© Stack Overflow or respective owner

Related posts about nhibernate

Related posts about asp.net-mvc