Configure the recycle time
When the site is accessed for the first time and Sitefinity CMS is activated, many operations are carried out before Sitefinity CMS can fully function. For example, configurations are loaded, resources are loaded, most of the modules and data providers are initialized, database connections are established, and object/relational mappings are constructed. In some cases, dynamic types also need to be constructed.
RECOMMENDATION: To improve the overall experience, configure the application pool to recycle the process as less as possible and configure your application to start automatically after recycle. You can configure it to recycle every 24 hours, during the time when the site is least accessed. For more information about how to configure auto start, see http://www.techbubbles.com/aspnet/auto-start-web-applications-in-aspnet-40/.
This way, the user who makes the first request after the recycle does not experience slow response because of the initialization. You can set up the recycle periods in the advanced settings of the application pool in the IIS management console. You must also disable recycling for idle time.
Delay application restart
Keep in mind that, by default, IIS restarts the application pool if the pool is idle for 20 minutes or more. To extend the restart delay:
- Launch the IIS Manager.
- Select the application pool for the Sitefinity CMS application.
- Click on Advanced Settings.
- Set the Idle Time-out (minutes) field to a larger value, for example, 240.
Another reason may be that the maximum number of precompilations is reached, which is 50, by default. As a result, ASP.NET automatically restarts the site, so that it recycles the application pool to unload the old version of your precompiled resources to free up memory, as it cannot store the resources infinitely. For example, if you perform publish-intensive operations like using SiteSync to sync changes to more than 50 pages, or alternatively to a template that more than 50 pages are based on, the application restarts.
To increase the maximum number of precompilations, in your project's web.config file, set a larger value of the numRecompilesBeforeAppRestart property in the following code line:
<compilation debug="true" targetFramework="X.X.X" numRecompilesBeforeAppRestart="50"> where X.X.X is the .NET framework of your project. For example 4.7.1 or 4.8
Defining the proper value for your application is a matter of how much memory you can spare. You can experiment and increase the value and monitor your memory consumption.