i came across a wonderful read about NHibernate L2 caching which i want to share with you guys,
The fast, reliable and mature O/R mapping features that NHibernate comes with provides a remarkable reduction in the overall development cycle. However, as the application grows in complexity and the data on which they thrive upon becomes complex, the generality of such OR mapping engines may lead to various performance and scalability bottleneck. Applications cannot scale linearly with the increasing transactional requirements. Caching is one approach that provides just the right solution to address such issues. Infect the fact that caching does provide a remarkable performance boost to applications performance is recognized by the makers of NHibernate. NHibernate provides some caching infrastructure. Bu default it provides a standalone InProc (in process) first-level (L1) cache, or session-level cache. However in addition, , NHibernate also supports a second-level cache to be plugged in to exploit the benefits of a sophisticated enterprise-grade caching infrastructure.
Why is Secondary (L2) Cache Required with NHibernate NHibernate provides a basic, not-so-sophisticated in-process L1 cache out of box. However, it doesn’t provide features that a caching solution must have to have a notable impact on the application performance. Some of the areas which NHibernate lacks in are:
1.Cannot handle ASP.NET worker process recycling:
2.Cannot handle ASP.NET web gardens:
3.Cannot handle ASP.NET web farms:
4. Cannot handle application scalability:
5.Cannot handle large cache size:
Thus it surly requires a secondary level caching infrastructure which can not only address the above mentioned problems but also boost its performance.
NCache – Pluggable Cache for NHibernateNCache provides just the right solution to problems highlighted above. It is extremely fast, enterprise-grade and highly scalable
level-2 distributed cache for NHibernate. It is an in-memory object cache for .NET that lets you improve NHibernate performance and scalability without any code change. Some of the immediate benefits are:
• Scale up with Mirrored, Replicated, Partitioned, and Client Cache topologies
• Software appliance for NHibernate (no code change required)
• Database synchronization of cache thru SqlDependency
NCache acts as a 2nd Level distributed cache that lets you improve your application performance and also scales out very nicely when your application needs to scale out. Below are some of the benefits of using clustered sessions:
1.Handles ASP.NET worker processes well:
2.Handles ASP.NET web farms:
3. Highly scalable:
4.No single point of failure (high availability):
5.100% Native .NET: NCache is a 100% native .NET product.