Optimize output cache

When Sitefinity CMS pages are loaded for the first time, they go through the following main stages:

  • Compilation
    This is the compiling of the page and all the widgets on the page. The widget properties are queried from the database and the widgets are compiled with the properties.
    When a page is updated in the backend, it will force the page to be recompiled on its next request.
  • Output generation
    This is the output generated from the requested page URL. This is the static HTML of the page and its output is cached. This provides the ability to serve the page immediately when it is in the output cache, because the HTML is already generated - the page and the widgets are already compiled and served directly. 

Using the output cache, you can perform the following optimizations:

  • Ensure output cache is turned on for all pages.
    For more information, see Administration: Cache for pages and libraries.
  • Increase the duration of the output cache. 
    You can extend it up to 24 hours (86400 seconds). You can configure this setting per output cache profile.
    For more information, see Administration: Configure cache profiles.
  • Consider disabling  output cache variation by all parameters.
    For more information, see Configure cache variation by query string.
  • Minimize the usage of Secured (protected) widgets
    Such widgets have view permissions different than the default ones, that is, Everyone. Pages with such widgets are not output cached for logged in users - both backend and frontend. The output caching is leveraged only for anonymous users.

    RECOMMENDATION: To show the content of a page to a specific segment of users, you can set permissions per role for the whole page, instead for specific widgets. Thus, the page content is cached and logged in users experience fast loading times.
    Alternatively, you can implement personalization per widget per user role, as well. Thus, you can leverage standard output caching on personalized content for specific user segments.
    For more information, see Personalize widgets.

  • Remove the Session_Start method from the Global.asax class.
    If you do not use the Session_Start method, comment it out. Even if the method is empty, it causes session generation. This also generates the ASP.NET_SessionId cookie. This can cause issues with compatibility with CDN's and can cause the output cache to be invalidated.

Want to learn more?

Sign up for our free beginner training. Boost your credentials through advanced courses and certification.
Register for Sitefinity training and certification.

Was this article helpful?