Sessions not timing out? Maximum Sessions?

Discussion in 'ASP.NET 2.0' started by rmvanduyn, Sep 15, 2006.

  1. It seems that our sessions are not timing out, and we are hitting a maximum session limit. Is this possible?

    I understand there is an IIS setting for the maximum number of sessions (http://www.velocityreviews.com/forums/t90432-maximum-sessions-per-client.html)

    Is this true, and does anybody know what DiscountASP sets this to?

    The reason why I ask is I have a simple monitor that executes the following in Global.asax in the Session_Begin handler:

    Application('NumberOfSessions') = Application('NumberOfSessions')+1

    and

    Application('NumberOfSessions') = Application('NumberOfSessions')-1

    in the Session_End handler.

    The second line never (well almost never...) seems to get called.

    I have a little HTML page that monitors this variable, and it just keeps going up all day long, until somewhere just past 50, the application gets recycled.

    If there is no limit on the number of sessions, is there some 'hidden' memory that is allocated for each session, that would (a) not show up in GC.GetTotalMemory, and (b) would be between 1-2MB? I am monitoring GC.GetTotalMemory and it does not grow as the number of sessions grows.

    The sessionState setting in the web config looks like this:

    <sessionState mode='SQLServer' allowCustomSqlDatabase = 'true'
    sqlConnectionString='data Source=sql2k502;database=SQL2005_206599_catprint;uid=*****;pwd=*****'
    cookieless='false'
    timeout='15'/>

    Any help as always is much appreciated!

    Mitch

    /emoticons/smhair.gif
     
  2. Your process might get recycled if your application exceeds 100 MB.

    It's common for the Session_End to not be called, same with the Application_End. These methods were put in so you could perform cleanup like closing or disposing of objects. Using them to tally data will almost always give inaccurate results.

    I doubt you are hitting a session limit, especially at 50.


    Joel Thoms
    DiscountASP.NET
    http://www.DiscountASP.NET
     
  3. Nope, such information is not reported anywhere,since not many web applications actually exceed that limit and if it does,there is surely an issue with the application.







    Vikram

    DiscountASP.NET
    www.DiscountASP.NET

    Post Edited (vvsharma) : 10/13/2006 10:25:01 PM GMT
     
  4. <...Your process might get recycled if your application exceeds 100 MB...>


    This seems like it would be important to know.


    How do we know if/when this might be occuring?


    Is this reported anywhere?
     
  5. So if Session_end is not reliable, what might we use for tallies and such?

    If I want to keep a running, accurate count on how many users are online, are there any suggestions?
     
  6. nothing you do will be accurate. a browser that has cookies disabled will register as a new user for each page hit. spiders that crawl your page will register as a user.

    nothing will truely be accurate.

    Though you could update anApplication levelHashTablewith every page hit, containing the SessionID and DateTime of page hit. Then you could specify a period of time (say 20 min) and remove everything from that HashTable over 20 min. You could also use Session_End to express removal of items earlier.

    You can further increase the accuracy of this by only adding browsers that support cookies and denying crawlbots and other such "browsers".



    Joel Thoms
    DiscountASP.NET
    http://www.DiscountASP.NET
     

Share This Page