MVC session times out too soon

Discussion in 'Site Programming, Development and Design' started by siulm, Jan 8, 2011.

  1. I have set up my session time out to expire in 720 minutes. But it seems, that the Worker Processes are recycling too soon.

    Does anyone have a solution for it?
    Has anyone encountered this issue?

    Ahead of time, thanks for your help.

    Siulm
     
  2. Ray

    Ray

    All the web servers have specific thresholds/conditions it must monitor for each application pool. If these thresholds are met, the system will recycle that application pool.

    1) More than 20 minutes of idle time (no http request in 20 minutes)
    2) The application uses more than 100 MB memory
    3) The application uses more than 75% of CPU time

    It sounds like your application is hitting one of these conditions and your applicaiton pool is being recycled. You'll need to make sure you optimize your web application so that it does not meet any of these conditions. In addition to that you can also use SQL session to store your session out of the web server and into a SQL server. That way if the application pool is recycled your session will not be lost.
    http://support.Winhost.com/KB/a626/how-to-enable-aspnet-sql-server-session-on-your-web.aspx
     
    Last edited by a moderator: Oct 14, 2015
  3. Issue with Session time outs

    I'm also having issues with sessions timing out, even on my new sites which don't have any users yet, so shouldn't be due to load on the server. They seem to time out randomly often after only 5 minutes.

    Some of the sites are using MVC but I also have one using Windows Forms .Net 2 which has the same issue.

    The sites were working fine on the hosting company I moved them from even under load, so it should not be anything to do with the programming.

    Any ideas?
     
  4. Ray

    Ray

    No, each application pool is isolated so other applications cannot affect it. Bear in mind that your site account can only carry one application pool so if you have multiple websites or web applications running in that application pool, then when that site crashes or reaches any of the thresholds, all the sites and web applications on that application pool will be recycled.
     
  5. Recycling due to CPU usage

    Hi Ray,

    Could you clarify how this limit works please? Does this apply to spikes, or is it only for sustained periods of high CPU activity?

    Regards,

    Drew.
     
  6. Ray

    Ray

    Sustained periods of CPU usage for 5 minutes. Normal short burst spikes is not counted as one of the conditions.
     
  7. Thanks Ray.
     
  8. Rapid-Fail Protection & Regular Time Interval Recycling

    @Ray,

    I'm just wondering whether in addition to the three conditions you listed above you have also configured Rapid-Fail Protection for our app pools (Max plan in my case.) It's enabled by default, I think. If you have, then with what parameters?

    Also, I believe the default behaviour is to recycle an app pool every 1740 minutes (29 hours) if no other recycling conditions are met. Do you include this condition?

    Finally, does the 200MB (Max plan) limit apply to virtual memory or private memory? This value must be specified in kB, so have you used MiB (204800 kB) or MB (200000 kB)?

    This might seem pedantic but I'm trying to reproduce your environment on my machine for testing purposes.

    This information would be covered if you provide the screenshot I asked for in this post just a few minutes ago: http://forum.Winhost.com/showthread.php?p=15655

    Many thanks,

    Drew.
     
    Last edited by a moderator: Oct 14, 2015

Share This Page