-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 4 posts ] 
Author Message
 Post subject: NHibernate and ASP.NET performance
PostPosted: Mon Jan 07, 2008 10:18 am 
Newbie

Joined: Tue Jan 09, 2007 5:24 am
Posts: 15
Hi there - I am using NHibernate and ASP.NET in my web applications.

I am using the "Open Session in View" pattern with an implementation similar to the one created by Brian Mcafferty in his article over on code-project.

Does anyone have any experience with performance?

The NHibernate Session module is starting an NHibernate transaction when the request arrives, and commits/rollbacks the transaction when the request completes.

My concern is that the NHibernate Session module will empty the connection pool.

Any pointers and hints will be greatly appreciated.

Cheers,
Thomas


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jan 07, 2008 6:02 pm 
Regular
Regular

Joined: Wed Jan 25, 2006 1:11 am
Posts: 118
Location: Copenhagen, Denmark
I think we need to know more about your application to see if nHibernate fits your needs. Furthermore it is uncommon that a web application needs to do all its work in a transaction, sure you don't mean an nHibernate ISession pr request?

But to give a very general answer, the team i am working in is using nHibernate for several projects some of them ASP.NET projects which has a large amount of users and we haven't hit any limitations in nHibernate yet when using it along with ones common sense ;-)


Top
 Profile  
 
 Post subject:
PostPosted: Tue Jan 08, 2008 7:51 am 
Newbie

Joined: Tue Jan 09, 2007 5:24 am
Posts: 15
Hi jta - thanks for your reply. I'll try to elaborate a bit.

I have an HttpModule that does the following:

BeginRequest:
Create an NHibernate transaction and saves it in my session manager.

The web application carries on with its work. It reads and modifies objects from the database using a session object in the session manager. When an object is requested an ISession object is created by my session manager and reused for the rest of the lifetime of the request.

EndRequest:
CommitTransaction and close session.


I believe the pattern above is called "Session in View". Correct me if I am wrong.

I find it very convenient that I do not have to think about opening and closing sessions in the web code. I am concerned, however, that this pattern is sucking up to many resources in terms of database connections etc.

Does anyone have any experience with this pattern when it comes to performance?

Cheers,
Thomas


Top
 Profile  
 
 Post subject:
PostPosted: Tue Jan 08, 2008 11:48 am 
Regular
Regular

Joined: Wed Jan 25, 2006 1:11 am
Posts: 118
Location: Copenhagen, Denmark
We use a setup where we have Session pr request just like you sketch however im still a little confused by your use of the sentence "nHibernate transaction".

nHibernate handles its connection pretty well and we have not had any problems using session pr request in webenvironment.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 4 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.