Optimize for performance

Default optimizations

The .NET Core Renderer application communicates with the CMS through HTTP calls over the IRestClient interface.

Sitefinity has the following calls optimized out-of-the-box:

  • The web service responses from coming from Sitefinity CMS are cached.
  • The Renderer leverages its own internal per-request cache.
    This way, it does not send duplicate CMS requests during the execution of a single page render request.
  • For faster communication, the IRestClient uses the HTTP 2 protocol underneath.
  • The Renderer uses page-level caching to cash the entire page.
    For more information, see Configure output cache.

Recommended optimizations

In addition to the above optimizations, you can further optimize the requests to Sitefinity CMS in the following ways:

  • Fetch only the data that you need.
    When fetching a collection of items using IRestClient.GetItems, make sure to pass a filter, Skip and Take, and Fields as parameters to fetch the minimum amount of data that is needed. 
    This is useful, because when the response comes in the HTTP protocol, it is in text format (JSON) and can get big, if the amount of data requested is large.
  • Avoid N+1 requests. 
    For example, if you fetch the items for a given collection of taxons, instead of making a request to the CMS for every taxon, consider combining them into a single request. 

    EXAMPLE: You can see examples at Sitefinity GitHub Repository » Filter items.

  • To check how many requests each page makes and which ViewComponent is making them, you can use page diagnostics.
    For more information, see Diagnostics and Troubleshooting » Page diagnostics.
    Long running and bulky requests are problematic and you should avoided them, if possible.
  • Sitefinity CMS and the Renderer must be closely deployed - in the same network.
    This way, you achieve a minimum roundtrip time for each request.
  • To fetch a collection of items for multiple MixedContentContext objects, use the helper methods in the namespace Progress.Sitefinity.AspNetCore.RestSdk.

    EXAMPLE: You can see examples at Sitefinity GitHub Repository » SelectorDemoUsageViewComponent.cs.

  • Use IHttpClientFactory for making requests to external services. 
    Using this interface is recommended by Microsoft, because the IHttpClientFactory reuses the same underlying TCP connection and automatically opens a new connection, if there is the need to. 
    Using HttpClient and disposing it puts the underlying connection in a TIME_WAIT state, therefore blocking it for use.
  • When possible, use HTTP2 protocol when making web requests.

Increase your Sitefinity skills by signing up for our free trainings. Get Sitefinity-certified at Progress Education Community to boost your credentials.

Get started with Integration Hub | Sitefinity Cloud | Sitefinity SaaS

This free lesson teaches administrators, marketers, and other business professionals how to use the Integration hub service to create automated workflows between Sitefinity and other business systems.

Web Security for Sitefinity Administrators

This free lesson teaches administrators the basics about protecting yor Sitefinity instance and its sites from external threats. Configure HTTPS, SSL, allow lists for trusted sites, and cookie security, among others.

Foundations of Sitefinity ASP.NET Core Development

The free on-demand video course teaches developers how to use Sitefinity .NET Core and leverage its decoupled architecture and new way of coding against the platform.

Was this article helpful?