locked
Long load times after idle time? RRS feed

  • Question

  • User260076833 posted

    Hello,

    my web application runs fine when it's "in use", i. e. the response times are ok.

    However, the response times are very high (> 30 sec), when it wasn't accessed for some time (e. g. 20 min).
    So it's not only in the morning when the first user accesses the application, but also all day long whenever the application was not used for some time.

    Recently, I was sure that this must be caused by the web server configuration in the data center. But they told me that the configuration is ok on their side and that the delay is caused by the application.

    Well, I don't know how the application should cause this behavior. It's a standard web application based on the Web Forms template and it uses Windows authentication.
    I did not change most of the web.config.

    Any idea, what I can do to get rid of these delays?

    Thanks
    Magnus

    Tuesday, October 4, 2016 8:49 AM

All replies

  • User753101303 posted

    Hi,

    When a web app is not used for some time it is put on hold and entirely removed from memorty. When hit again you have then a startup time. It depends on :
    - which publishing approach you choose (ie which amount of compilation/JIT comoialtion needs to be done)
    - what you are doing yourself when the app starts (Application_Start etc...)
    - how the web site is configured (the application can be configured to be "suspended" rather than entirely removed) - and more likely an hosting service won't allow everyone to use that

    The first step would be likely to understand if it is caused by your own code (Watch out for what you are doing when the application or the session starts). If you publish source code, it might be also quicker if you publish compiled code instead. Not sure if you can get some data from your host service to help narrowing down the place where this timeis spent.

    Tuesday, October 4, 2016 10:04 AM
  • User-2057865890 posted

    Hi Yeoman,

    The efficiency of your ASP.NET page and code-behind page logic plays a large part in determining the overall performance of your Web application. The following guidelines relate to the development of individual .aspx and .ascx Web page files.

    • Trim your page size.
    • Enable buffering.
    • Use Page.IsPostBack to minimize redundant processing.
    • Partition page content to improve caching efficiency and reduce rendering.
    • Ensure pages are batch compiled.
    • Ensure debug is set to false.
    • Optimize expensive loops.
    • Consider using Server.Transfer instead of Response.Redirect.
    • Use client-side validation.

    reference:

    https://msdn.microsoft.com/en-us/library/ff647787.aspx

    https://msdn.microsoft.com/en-us/library/cc668225.aspx 

    Best Regards,

    Chris

    Wednesday, October 5, 2016 3:01 AM
  • User260076833 posted

    Hello and thank you for your answers,

    @PatriceSc:

    Unfortunately, the data center is not willing to help me to locate the problem. So I need to check the possible points myself.

    Let's begin with the application start. I do nothing special at application start. I believe, the code was generated when the project was created:

            void Application_Start(object sender, EventArgs e)
            {
                // Code that runs on application startup
                RouteConfig.RegisterRoutes(RouteTable.Routes);
                BundleConfig.RegisterBundles(BundleTable.Bundles);
            }
    

    So the next point would be the publishing approach. If I understand you right. you may configure the project so that all the compilation is done before publishing and no JIT compilation is necessary. Where can I make this configuration? I didn't find anything in the project configuration.

    The other point you mentioned was how the web site is configured and that you can put the application in suspend mode, from which it would be reactivated faster. Is this a configuration that I can do in my project or has it to be done at the server side in IIS?

    Where can I go from here?

    @Chris:

    Your answer relates to general performance issues and recommendations for code optimization. In my case this is not the point: Every page (simple and complex) runs fine when it's not the first access, and every page (simple or complex) takes a long time to load when it's the first access after the application fell asleep. I believe that even a totally empty page would behave like this. There must be a mechanism in the delivery process that causes the delay.

    Thanks
    Magnus

    Wednesday, October 5, 2016 4:49 AM
  • User260076833 posted

    No idea what I can do?

    If it's important: The IIS version is 7.5.


    Magnus

    Thursday, October 6, 2016 5:09 AM
  • User-2057865890 posted

    Hi Yeoman,

    If you have a few sites on your server and you want them to always load fast then set this to zero. Otherwise, when you have 20 minutes without any traffic then the app pool will terminate so that it can start up again on the next visit.

    reference: Fixing slow initial load for IIS web site IIS 7.5

    Besides, please consider posting IIS related questions to http://forums.iis.net/. You may get quicker and better responses there.

    Best Regards,

    Chris

    Thursday, October 6, 2016 8:34 AM
  • User260076833 posted

    Hello Chris,

    thank you very much. I have forwarded this notice to my provider and I hope that he will adapt the configuration.

    Thanks
    Magnus

    Thursday, October 6, 2016 1:33 PM
  • User1771544211 posted

    Hi Yeoman,

    However, the response times are very high (> 30 sec), when it wasn't accessed for some time (e. g. 20 min).

    It seems that you meet the Idle Time-out(default:20min) setting on IIS. Idle Time-out is if no action has been asked from your web app for some time, the IIS process will drop and release everything from memory. Then when a user request the page, the application will take some time to load large amounts of data, or perform expensive initialization processing, before they are ready to process requests. So it will take a long time to response the customer's request.

    You can configure the auto-start feature to avoid this, please find how to configure the auto-start feature in the following link.

    https://weblogs.asp.net/scottgu/auto-start-asp-net-applications-vs-2010-and-net-4-0-series

    Best Regards,

    Jean

    Tuesday, October 25, 2016 2:05 AM