HomeDev GuideAPI Reference
Dev GuideAPI ReferenceUser GuideGitHubNuGetDev CommunitySubmit a ticketLog In
GitHubNuGetDev CommunitySubmit a ticket

Performance considerations

Describes specific performance-related areas that are particularly important to consider for cloud-based solutions compared to on-premises solutions.

CDN settings

A content delivery network or content distribution network (CDN) aims to ensure high availability when serving content to visitors. CDN consists of a globally distributed network of proxy servers deployed in multiple data centers. CDNs deliver content from the fastest and closest server available.

The CDN servers are designed to cache content according to the cache rules you define in the HTTP headers from your application. These caching rules must be correctly set so your solution can scale properly. See CDN Recommendations.

Site startup

Proper site warmup is crucial for cloud-based environments. Because a node may be brought out for maintenance at any time and then put back in during peak hours, a node that gets a full share of traffic without being warmed up first will cause response-time spikes and increase the risk of outages.

Use custom scripts or the built-in ASP.NET feature that automatically starts and initializes a web application to warm up the server and prepare data caches. See Initialization.

Limiting the number of content types is a good practice. During a startup, assemblies are scanned, and views are cached. Many (200+) content types significantly affect the startup time. You should also keep the Web App below 1 GB at all times. This includes binaries and .cshtml views but not media assets and logs that should be written to a BLOB storage container.

Output cache

Cloud-based solutions are more likely to scale out the web servers rather than to scale them up. This means that each front-end node also contributes to a constant load to the database. In other words, if you go from two front-end servers (a typical on-premises setup) to four front-end servers while keeping the total throughput the same, the load on the database server increases.

When scaling out, it is important to ensure that the machines that spend the most effort building a page are the front-end servers. Caching in multiple layers (object caches, partial HTML caches for complex menus, and full output cache) helps avoid a "cache stampede," especially when combined with a warmup.

When a page is published, output caches are immediately invalidated for all sites by default. This causes output cached pages to be re-rendered using the lower-level caches. Most of these lower-level caches remain valid after a publish, except for the published page caches. Implementing proper multi-layer or partial caching for rendered pages with heavy data processing is important. See Caching

Entity tags (ETags)

The ETag or entity tag is part of the HTTP protocol to determine web cache validation. See CDN Recommendations for information about using ETags.

Resilience

In a cloud environment, retry policies become increasingly important. Transient errors may occur due to network issues or maintenance of infrastructure elements, and retry policies let the application gracefully recover from such errors without propagating the error to the end user.

Retry mechanisms for Azure services differ because each service has different requirements and characteristics. Each retry mechanism is tuned to a specific service. See information about transient faults and retry policies, and the Azure SDK for .NET for guidelines.

Storage

Because the virtual machines hosting a Web App may be restarted anytime, you risk losing any information stored in the file system. Also, if you have large media volumes, you should store assets in a BLOB storage instead of in the Web App because this will limit scalability. Optimizely provides access to BLOB storage through a BlobProvider interface.

📘

Note

Some third-party components such as Lucene.NET that use file shares or files local to the web server, may have problems with high traffic in a cloud environment, and are therefore not supported.