SessionFactory Caching and Tuning for Multiple Databases with NHibernate

Some of the questions here on StackOverflow about NHibernate and several databases (dynamically connected) allow me to think that the best solution would be to keep the SessionFactory cache (for each database) and the cache in Configuration to quickly create a SessionFactory.

I would like to know if this approach is correct, and basically: what is the "weight" of a SessionFactory in terms of memory consumption per instance and time to create?

MORE ABOUT MY APPROACH:

It is known that level 1 and level 2 caches live in the SessionFactory area, we could assume that memory consumption could be related to the amount of ISession open (which includes level 1 cache).

For the second level of the cache, in my case when the databases have the same schema and have some readonly commom tables, I could use a global cache implementation that uses only readonly tables in all SessionFactories, this is good for my project.

I'm right? What performance and memory issues could I have with this approach? Consider a web application (ASP.NET MVC, not web forms) that accesses several hundred (or perhaps thousands) of databases, in each HTTP request it needs to find the user database and access (obtain, use) and dispose of ISession).

: ? , ? , NHibernate, ?

+5
1

, ( ) SessionFactory, , SessionFactory - . , , , , .

, , SessionFactory Configuration, -, , SessionFactory , "eater ", OutOfMemoryException 400 , , .

, SQLServer, , SessionFactory SQLServer, , ConnectionProvider sql USE 'catalog-name', .

, , SQLServer, , ( ).

.

+2

All Articles