The Sitefinity CMS web application startup process leverages the standard .NET application startup logic. There are, however, a few Sitefinity CMS specifics to be aware of during the system startup or upgrade phases.
The startup process is invoked in the Init() method of the SitefinityHttpModule. The method is executed asynchronously as a background task. In the meantime, the Sitefinity CMS application is responsive and returns the current status. The diagram below demonstrates the execution flow of the Bootstrap method, including default functions and custom logic:
The actual system initialization, including the core system initialization and module's initialization, occurs in the SystemManager.Initialize() method. The following diagram looks into detail in the system initialization process:
All modules are initialized in the system. During initialization, the system invokes the installation or upgrade procedures, if needed. Next, the system collects information about the modules' managers and aggregates their data mapping. That is, registers all metadata mappings at once, instead of doing it for each module separately, which boosts the application performance. This process occurs between the Initialize Active Modules and Load Registered Modules steps in the diagram above.
Finally, the system calls the Load() method of each module. The Load() method is where any logic for integration with the system and other modules is implemented. The following diagram demonstrates the flow of the initialization of a single module in Sitefinity CMS:
In case the module is not installed or upgraded, the system forces the modules manager providers to upgrade and executes the respective module installation or upgrade logic:
You can diagnose and measure the startup process by adding the following setting in the web.config file:
With the help of this setting you get and output file displaying a tree view with the duration of the startup process. in addition, you get each each internal code block wrapper in the MethodPerformanceRegion method.
Keep in mind that you can also work with the Diagnostic Module, as it is integrated with the MethodPerformanceRegion.
To optimize startup times of your website, you can leverage the Microsoft .NET Compiler Platform, called Roslyn. Enabling Roslyn for your Sitefinity CMS application, you end up with improved startup and pre-compilation times. For more information, see Roslyn GitHub Overview.
In Sitefinity CMS, you can enable Roslyn in two ways:
NOTE: You need to install version 1.0.5 of the Roslyn package.
As a result, you enable the Roslyn compiler and optmize your site startup.
You can also use the Sitefinity CMS custom tool for precompiling pages. For more information, see For developers: Precompiler tool.
To learn how to keep the already compiled pages during startup, see Optimize development.
Back To Top