.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:

100 threads 100,000 requests.

Working mode configuration can be modified in the project file

< ServerGarbageCollection> false </ ServerGarbageCollection>


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


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





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



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




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




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