Migration from .NET5 to .NET 6: Performance benchmarks
Tags: opensource, dotnet, performance, productivity
Published: 2022-02-08 10:03:02

## Introduction

This post continues the series of articles ([Migration from .NET Core 2.2 to .NET Core 3.1](https://www.nopcommerce.com/migration-from-net-core-22-to-net-core-31-nopcommerce-experience) and [How to Migrate a Project From ASP.NET MVC to ASP.NET Core](https://dev.to/dmitrykulagin2/how-to-migrate-a-project-from-asp-net-mvc-to-asp-net-core-2368)) on upgrading the nopCommerce project – a free . net eCommerce CMS with an open source code for creating online stores. This article discusses why we continuously strive to upgrade our application’s platform. Here we tell you what we achieved with migration to .NET 6 in terms of performance and try to evaluate our results practically.

## The reasons for migration

Those who monitor the nopCommerce upgrades know well that we do our best to upgrade the application core as promptly as possible. This is facilitated by the continuously evolving Microsoft technologies reflected in the .NET Core platform.
One of the primary objectives is switching to the long-term support (LTS) release. This is because the current .NET 5 version is to be supported and debugged for 1.5 years since the release date. The upgraded nopCommerce 4.50 version is already based on the .NET 6 platform with a 3 years support, which is crucial for the end users and will provide the community with sufficient time to update their stores and plugins for them. That being said, expectations of the following version will be accompanied by regular upgrades, including security ones.

![.NET LTS](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/7xi23mn56hqtdsl294gd.png)

With the .NET 6 release, the Microsoft developers have brought .NET most closely to the single platform for developing all the application types present, starting with desktop and web applications, and ending with mobile apps development. Such a unification allows us to release a mobile application for nopCommerce in a single C# codebase, which will undoubtedly benefit our developer community in terms of immersion and understanding the entire nopCommerce ecosystem.  
Also, we planned to raise the performance bar of our application with the switch to .NET 6. Going ahead, the measurement results revealed some interesting data regarding the nopCommerce evolution, and we would like to share them.

## .NET 6 performance benchmarks in the application

To measure load and scalability, we chose a quite popular SaaS service, loader.io, as the test tool. An average machine for development was used as the server with the deployed application:

* CPU - Intel(R) Core(TM) i5-7400 CPU 3.00 GHz
* RAM - 16.0 GB

The tests were managed using Windows 10 (19044.1415) and IIS 10 (10.0.19041.1415). We used a standard database provided at the application setup. All of these were managed using MS SQL Server 2019 (19.0.2000). 
To simulate the load, we chose the test configuration that would connect 250 users during a minute. The users would visit a few random application pages. These would be sufficient to provide the general picture of the platform response and visualize the difference relative to the previous versions.
 
Further, I will present the correspondence table with the nopCommerce application and .NET platform versions.

| nopCommerce |      4.30     |  4.40.4  |  4.50  |  
--- |--- |--- |---  
| *.NET*        | *.NET Core 3.1* |  *.NET 5*  | *.NET 6* |

We made 3 consecutive load tests to gain insights into the load nature and memory consumption on the server. The average results from several runs are given below.
Response time measurement (the less, the better). There is an evident trend in performance improvement compared to .NET 5 and .NET Core 3.1 versions: 46.1% and 65.3%, respectively.

![Average response time](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/l40ff0gjsnemkgmthjpr.png)
 
Measurement of the memory usage by the application (the less, the better). The tests were run in succession for each platform without resetting the application pool. It should be considered that the .NET platform’s memory overhead has increased; this is apparently the inevitable cost of the enhanced performance. However, we must note that the optimization promised in .NET 6 can be seen here.

![Memory consumption](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/mh2umjwoe493ui7vvmm5.png)

### .NET 6 vs .NET 5: Load distribution

Let’s now consider the load distribution in the nopCommerce platform with .NET 6 in detail and compare it with the same test data for .NET 5. Importantly, here, we are showing the general trend for the system working on different platforms rather than revealing the limit values at which the system would go off balance because this is largely dependent on the technical data of the server under test.

#### Load distribution in .NET 6

![Load distribution in .NET 6](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/4zm5bgmuihy0fbnwg5zz.png)

#### Load distribution in .NET 5

![Load distribution in .NET 5](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ami8cxspn752uha89jsq.png)

Analyzing this, we can see an interesting pattern from the .NET 6 benchmarks: with an increasing number of clients per second, the average response time in the plot maintains a sufficient distance from that of .NET 5. The upgraded version’s curve is smoother and has fewer bursts. Another good indicator is that the curves don’t cross each other during the entire test. This is indirect evidence of the enhanced performance. .NET 6 handles the test more easily than .NET 5 does.

## Summary

Once again, we have made sure that following the latest technological advances by Microsoft is beneficial. Apart from the improved performance, we got an upgraded platform that will allow us to move in a new direction. This is, of course, the mobile application: something we started heading to back in version 4.40 by implementing Web API that covers literally all the functions provided by our platform. We have slightly more memory overhead in favor of performance improvement: this should be considered when choosing the hosting provider. However, since the current version will be dominant among the others in our community in the mid-term, switching to it seems the most practical solution.

Learn more on the [.net open-source platform's website](https://www.nopcommerce.com/download-nopcommerce) or visit [our GitHub repository](https://github.com/nopSolutions/nopCommerce)