NHibernate SQL server connection pooling? -


i attempting speed web service calls , suspect opening many nhibernate connections problem. aware opening new connection sql server time consuming , expensive. thought nhibernate preserve single connection (therefore needing open once) if opened nhibernate session in many places.

so here's few different parts question:

  • if create session , dispose of it, create again, take same time load second time around, or sql server connection still in background use? this:
     using (var session = new sessionfactory.opensession()) {... };     using (var session2 = new sessionfactory.opensession()) {.. }; 
  • if create session within using statement, , create 1 within statment (without disposing it) not need spin whole other sql server connection in background? this:
     using (var session = new sessionfactory.opensession())      {         using (var session2 = new sessionfactory.opensession()) {.. };     }; 
  • lastly, sql server connections preserved across web service calls? ie if open session on web service request call #1, web service request call #2 faster since hidden connection sitting around somewhere in background pick , use?

i aware it's best in cases use 1 session, large program written many new sessions open on , i'm trying figure out whether save performance re-write or not.

thanks!

nhibernate not work if open session within session. connections pooled , once not used returned pool. if pool not have connections available, new 1 created. suggest query optimizations , caching. connections not speed things up.


Comments

Popular posts from this blog

php - cannot display multiple markers in google maps v3 from traceroute result -

c# - DetailsView in ASP.Net - How to add another column on the side/add a control in each row? -

javascript - firefox memory leak -