Comparison and Analysis of the. NetCore GC working mode, coregc
. NET Core is an open-source general-purpose development framework with cross-platform capabilities. While enjoying its soaring performance, we also face some problems. By observing the online running status of the NetCore program, it is found that the application occupies a large amount of memory when the load is high. This article will discuss this issue and compare and analyze the problems in different GC working modes. netCore performance and memory management performance. By searching for information, we know that the GC working mode of. Net Core can be roughly divided into four working modes. Next, we will test these four modes. The following lists the configuration methods, program memory usage, and pressure test aggregation reports for each mode:
Server: CPU: E5-2609 v3 @ 1.9G
Memory: 8 GB.
Test Tool: jmeter has 100 million requests from 0.1 million threads.
You can modify the working mode configuration in the project file.
<ServerGarbageCollection> false </ServerGarbageCollection>
<ConcurrentGarbageCollection> false </ConcurrentGarbageCollection>
You can also directly modify the runtimeconfig file in the release package.
1. Concurrent & Workstation GC (Workstation mode, enabling Concurrent garbage collection)
Ii. Background & Workstation GC (Workstation mode, disabling concurrent garbage collection)
Iii. Concurrent & Server GC (Server mode, enabling Concurrent garbage collection)
Iv. Background & Server GC (Server mode, disable concurrent garbage collection)
V. Conclusion
By comparing the four test results, we can see that the memory control in the workstation mode is significantly better than that in the server mode. gc works frequently, but the consequence is the performance decline, it can be seen that the corresponding time and throughput of the server mode is better than that of the workstation mode, where the server mode is the default working mode. The above test results are for reference only. The results remain unchanged after repeated tests.