Best practices to improve ASP.NET Core application performance

Performance is one of the vital characteristics of an application to make it fruitful. In the event that a site or web page requires over 3 seconds to answer, the user doesn’t like it. For a public website, Google and other search engines additionally really like to suggest streamlined, versatile, and faster sites.

This article will focus on some of the best practices to improve ASP.NET Core application performance.

Below points can improve ASP.NET Core application performance –

Avoid Blocking Calls

A blocking call is also called a Synchronous call. You must plan your ASP.NET Core application to execute multiple processes at the same time.
Furthermore, you can accomplish this through an Asynchronous Programming interface that handles a huge number of requests without looking out for blocking calls.
Instead of looking out for the synchronous tasks to finish, it can begin dealing with another execution.
A blocking call implies a call that impedes the following execution until it isn’t finished.

Always use Asynchronous Programming

The asynchronous programming model was presented in C# 5.0 and became extremely famous.

Asynchronous programming is a type of programming that permits a bunch of tasks to run independently from the essential application. At the point when the work is finished, it informs the main thread.

There are various advantages to utilizing it, like better application execution and upgraded responsiveness.
Asynchronous programming permits a client to continue on ahead in an application, while processes run behind the scenes, hence improving the client experience.

Use Cache

To enhance the performance of the application, the usual trick is to diminish the number of calls to the server. How Cache functions: A request is sent to the server and the response is stored in a temporary location. Thus, when the next time the same call is made to the server, rather than accessing the server, the information gets checked from the temporary location and sent back to the client.

This is the way reserving saves time and works on the application performance; decreasing the server calls over and over.

Optimize Data Access

To improve the performance of the application, we can tune the data access layer. As the data is requested from the database, getting it each time will be tedious.

Use of Cache Tag Helper

Caching can significantly improve ASP.NET Core applications by reducing page load time. With Cache Tag Helper, we cache HTML content. We usually cache content that does not change frequently.

<cache expires-after="@TimeSpan.FromMinutes(10)">
    Requested Time  @DateTime.Now.ToLongTimeString()

Use gRPC for calling services to improve communication performance

Assuming your web application is based on REST Programming and consumes microservices frequently, changing your method of communication to gRPC might be advantageous. gRPC stands for Google Remote Procedure Call, it is an open-source and high performance RPC framework which is platform independent. It is developed by Google. gRPC supports languages like C#, Java, Ruby, Python, Go.

gRPC is ideal for low latency network and is highly scalable for distributed system.

Enable compression

Reducing the size of the response improves the exhibition of the application on the grounds that less information is moved between the server and the client. You can exploit response pressure in ASP.Net Center to recoil the response and lessen bandwidth necessities. Response pressure in ASP.Net Center is accessible as a middleware component.

public void ConfigureServices(IServiceCollection services) 
        (options => 
            options.Level = CompressionLevel.Fastest; 

Minify client assets

ASP.NET Core applications with complex user interface as often as possible serve numerous JavaScript, CSS, or image files.

Performance for these types of files can be improved by:

  • Bundling, which joins numerous files into one.
  • Minifying the resource file, which decreases the size of files by eliminating whitespace and extra remarks.

Use the latest ASP.NET Core release

Each new version of ASP.NET Core incorporates performance upgrades. Enhancements in ASP.NET Core imply that the more current versions usually perform better compare to the older version.

For instance, .NET Core 2.1 added support for compiled regular expressions and benefitted from Span<T>. ASP.NET Core 2.2 added support for HTTP/2. ASP.NET Core 3.0 adds numerous enhancements that diminish memory use and further enhance throughput. In the case where performance is really important, consider moving up to the higher version ASP.NET Core.

Switch to the In-Process Hosting model in IIS

The in-process hosting model gives you a boost to the ASP.NET Core application. In-process hosting provides improved performance as compared to out-of-process hosting because requests aren’t proxied over the loopback adapter. The loopback adapter is a network interface that returns outgoing network traffic back to the same machine. IIS handles process management with the Windows Process Activation Service (WAS).


By applying the above methods you may definitely enhance the performance of the ASP.NET Core application. These tips apply to most of the versions of .NET Core. Apart from above mentioned best practices you may reduce or compress image size if your application/ website has more images and graphics. You may also try CDN for CSS, JavaScript and other files which load frequently on each request.

CDN will serve the files from the nearest cached server and in turn, it will reduce the server burden.

Try to apply the above methods in your ASP.NET Core application or website and you will see a drastic improvement in ASP.NET application performance.

Leave a Comment