.NET Core is an open source and universal development framework with cross-platform capabilities. While enjoying its soaring performance, we also face some problems. By observing the online operation of the NetCore program, it is found that the application occupies a large amount of memory under high load conditions. This article will discuss this issue and compare and analyze the performance of .NetCore and memory management under different GC operating modes. By looking up the information, we know that the GC working mode of .Net Core can be roughly divided into four working modes. Next, test these four modes directly. The following lists the configuration mode, program memory usage, and stress test aggregation report for each mode:

Server: CPU: E5-2609 v3 @ 1.9G

Memory: 8G.

Test tool:
jmeter

100 threads 100,000 requests.

Working mode configuration can be modified in the project file

< ServerGarbageCollection> false </ ServerGarbageCollection>

ConcurrentGarbageCollection>

You can also directly modify the runtimeconfig file in the distribution package.

 

First, Concurrent & Workstation GC (workstation mode, enabling concurrent garbage collection)

 

 

dotnet_core_server_mode_and_workstation_mode_compare_2.png

 

Second, Background & Workstation GC (workstation mode, disable concurrent garbage collection)

 

dotnet_core_server_mode_and_workstation_mode_compare_4.png
dotnet_core_server_mode_and_workstation_mode_compare_5.png

Third, Concurrent & Server GC (server mode, enable concurrent garbage collection)

 

dotnet_core_server_mode_and_workstation_mode_compare_7.png

dotnet_core_server_mode_and_workstation_mode_compare_8.png

Fourth, Background & Server GC (server mode, disable concurrent garbage collection)

dotnet_core_server_mode_and_workstation_mode_compare_10.png

dotnet_core_server_mode_and_workstation_mode_compare_11.png

 

V. Conclusion

By comparing the four test results, it can be seen that the workstation mode memory control is significantly better than the server mode, and gc works frequently, but the consequence is a decline in performance. It can be seen that the corresponding time and throughput of the server mode are better. In workstation mode, the server mode is the default operating mode. The above test results are for reference only. After repeated tests, the results are roughly unchanged.

Orignal link:https://www.cnblogs.com/JayChristopher/p/11894920.html