September 27, 2022

Blog @ Munaf Sheikh

Latest news from tech-feeds around the world.

Migration from .NET5 to .NET 6

Great post from our friends at Source link

Introduction

This post continues the series of articles (Migration from .NET Core 2.2 to .NET Core 3.1 and How to Migrate a Project From ASP.NET MVC to ASP.NET Core) 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 3 years of 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. 

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 run time results

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.

Results of memory usage by the application 

.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

Load distribution in .NET 5:    

Load distribution in .NET 5

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 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 about our project on the nopcommerce.com website or visit our GitHub repository

#Migration #NET5 #NET