Inlining

Making sure that all your statements are inlined by the Just-In-Time (JOT) compiler can vastly increase performance. Throw statements can slow things down so using a static helper can help keep things moving fast by containing them.

Less Virtual Calls

Minimize the amount of calls to virtual members as these use resources. If you can de-virtualize the calls your JIT compiler can then inline the calls. Follow these 2 basic steps to help get rid of unnecessary virtual calls:

  • Seal overridden methods and mark classes and methods as sealed (by default).
  • Use concrete types not interfaces

Pool HTTP connections

Use Http Client Factory. This was introduced in ASP.Net Core 2.1 to help you pool HTTP connections thereby increasing performance and reliability.

Reduce allocations

New types have been introduced which can be leveraged to increase performance for example, the introduction of SystemValueTuple. Taking advantage of these will avoid data copying and array allocations and improve the core performance.

Aggressive Caching

Make sure any stale data is cached immediately. There is middleware supported by ASP.Net Core to assist with this. Ncache is something that helps cache stale date which is fast acting and easy to set up.

Enable compression

A smaller response improves the apps performance by reducing the amount of data transfer. ASP.Net Core supports response compressing as a middleware component allowing you to add this to the pipeline easily.

Reduce HTTP requests

A good way of optimizing performance is to reduce the number of number of HTTP requests or by using HTTP/2. This combined with caching and reducing redirects can have a good impact on performance.

Avoid blocking calls

Avoid blocking calls using Task.Wait or Task.Result - just make asynchronous code paths and utilize PerfView or similar performance profile programs.

Lessen large object allocations

Although .Net Core’s own program can release memory doing so uses CPU time, ArrayPool is the better option. This will cache frequently used objects rather than focus time and space freeing up large objects.

Use exceptions sparingly

Take care to avoid unnecessary exceptions. Using them only when needed will up performance.

Optimize data access

Data access APIs should be accessed asynchronously, avoiding multiple data collection trips and only pick up the necessary data. Data access is one of the key factors that slow an application.

Tuning a web application to enhance performance is complex but there are tools and techniques in place to help. MiniProfile, Application Insights, Stackify Retrace and MiniProfiler are application performance measuring tools to look out for. These can look at the issues and determine how to easily fix them, making the process easier for the developer.

If you're looking for a company that provides system integration and other software development services contact us.

Send Message

This field could not be empty.
This field could not be empty.
Incorrect email.
This field could not be empty.
This message could not be send. Please select correct CAPTCHA.
Your message has been successfully sent. We will respond as soon as possible.

Contact Us

Phone
+1 (949) 316-1161

Address
2372 Morse Avenue,
Ste. 607,
Irvine, CA 92614
Phone
+375 (29) 744-23-52

Address
Business Center "Park Plaza",
22a/2 Lahoyski Trakt, Suite 304,
Minsk, 220090 Belarus