Do you have Connection Pooling=False there? Or very small pool size? On Fri, Feb 6, 2009 at 11:25 PM, Robin Nadeau <[email protected]> wrote:
> You'll understand that all the data in our connectionstring is secret > information, but it does contain the Data Source, the Network Library, > Initial Catalog, User ID and Password. Nothing out of the ordinary. As for > usage, I'll investigate that. > > > On Fri, Feb 6, 2009 at 4:15 PM, Ayende Rahien <[email protected]> wrote: > >> What is the connection string? Maybe it was turned off for some reason? >> Do you see gradual increase in the number of users over the week? >> >> >> On Fri, Feb 6, 2009 at 11:11 PM, Robin Nadeau <[email protected]> wrote: >> >>> By default connection pooling is enabled in ado .net, so I assume it >>> works the same with NHibernate. We had the default number of connections. >>> >>> >>> On Fri, Feb 6, 2009 at 4:07 PM, Ayende Rahien <[email protected]> wrote: >>> >>>> That is one option, certainly. >>>> but, do you have connection pooling enabled? >>>> What is the # of connections in the DB now? >>>> >>>> >>>> On Fri, Feb 6, 2009 at 11:04 PM, Robin Nadeau <[email protected]>wrote: >>>> >>>>> We're using SQL Server 2005. My other theory is that we simply don't >>>>> have enough database connections at peak periods. >>>>> >>>>> >>>>> On Fri, Feb 6, 2009 at 4:00 PM, Ayende Rahien <[email protected]>wrote: >>>>> >>>>>> Extremely unlikely. >>>>>> If this happens, then the session (and the connection) would go out of >>>>>> scope and would be reclaimed by the GC >>>>>> The finalizer should release the connection anyway. >>>>>> >>>>>> What DB are you talking about? >>>>>> >>>>>> >>>>>> On Fri, Feb 6, 2009 at 10:58 PM, Robin Nadeau <[email protected]>wrote: >>>>>> >>>>>>> I'm using the session-per-request pattern for nhibernate and am >>>>>>> running out of database connections. This takes about 1 week to occur >>>>>>> on a >>>>>>> heavily loaded server, taking about 100,000 hits per day. The code I >>>>>>> use to >>>>>>> manage my session is below. My theory is that the httpsession could >>>>>>> timeout >>>>>>> before the EndRequest event, causing the reference to the session to be >>>>>>> lost, and therefore no closed. Is that even possible? If so, what can be >>>>>>> done about it? >>>>>>> >>>>>>> Public Class NHibernateSessionPerRequestModule >>>>>>> Implements IHttpModule >>>>>>> >>>>>>> Public Sub New() >>>>>>> End Sub >>>>>>> >>>>>>> >>>>>>> ' In the Init function, register for HttpApplication >>>>>>> ' events by adding your handlers. >>>>>>> Public Sub Init(ByVal application As HttpApplication) _ >>>>>>> Implements IHttpModule.Init >>>>>>> AddHandler application.BeginRequest, _ >>>>>>> AddressOf Me.Application_BeginRequest >>>>>>> AddHandler application.EndRequest, _ >>>>>>> AddressOf Me.Application_EndRequest >>>>>>> End Sub >>>>>>> >>>>>>> Private Sub Application_BeginRequest(ByVal source As Object, _ >>>>>>> ByVal e As EventArgs) >>>>>>> 'Fires when the request begins >>>>>>> Try >>>>>>> If >>>>>>> (HttpContext.Current.Request.Path.ToLower().IndexOf(".aspx") > -1) Then >>>>>>> Dim session As NHibernate.ISession = >>>>>>> StaticSessionManager.OpenSession() >>>>>>> session.BeginTransaction() >>>>>>> CurrentSessionContext.Bind(session) >>>>>>> End If >>>>>>> Catch ex As Exception >>>>>>> Dim objLoggingController As New >>>>>>> AlertPay.Utilities.LoggingController >>>>>>> objLoggingController.Write("Error in creating NHibernate >>>>>>> Session", "Information", 0, "0", "NHibernateSessionPerRequestModule") >>>>>>> End Try >>>>>>> >>>>>>> >>>>>>> End Sub >>>>>>> >>>>>>> Private Sub Application_EndRequest(ByVal source As Object, _ >>>>>>> ByVal e As EventArgs) >>>>>>> >>>>>>> If >>>>>>> (CurrentSessionContext.HasBind(StaticSessionManager.SessionFactory)) >>>>>>> Then >>>>>>> Dim session As NHibernate.ISession = >>>>>>> CurrentSessionContext.Unbind(StaticSessionManager.SessionFactory) >>>>>>> If Not session Is Nothing Then >>>>>>> Try >>>>>>> session.Transaction.Commit() >>>>>>> Catch >>>>>>> session.Transaction.Rollback() >>>>>>> Dim objLoggingController As New >>>>>>> AlertPay.Utilities.LoggingController >>>>>>> objLoggingController.Write("Error in commiting >>>>>>> NHibernate Session. Rolling back transaction", "Information", 0, "0", >>>>>>> "NHibernateSessionPerRequestModule") >>>>>>> Finally >>>>>>> If session.IsOpen Then >>>>>>> session.Close() >>>>>>> End If >>>>>>> End Try >>>>>>> End If >>>>>>> End If >>>>>>> >>>>>>> >>>>>>> >>>>>>> End Sub >>>>>>> >>>>>>> Public Sub Dispose() Implements System.Web.IHttpModule.Dispose >>>>>>> End Sub >>>>>>> >>>>>>> End Class >>>>>>> >>>>>>> >>>>>>> -- >>>>>>> Robin Nadeau, B.Eng. >>>>>>> Software Developer >>>>>>> >>>>>>> >>>>>>> >>>>>> >>>>>> >>>>>> >>>>> >>>>> >>>>> -- >>>>> Robin Nadeau, B.Eng. >>>>> Software Developer >>>>> >>>>> >>>>> >>>> >>>> >>>> >>> >>> >>> -- >>> Robin Nadeau, B.Eng. >>> Software Developer >>> >>> >>> >> >> >> > > > -- > Robin Nadeau, B.Eng. > Software Developer > > > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "nhusers" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/nhusers?hl=en -~----------~----~----~----~------~----~------~--~---
