In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-14 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/03 Report--
This article will explain in detail the example analysis of .net Core memory recovery mode and performance test comparison. The editor thinks it is very practical, so I share it with you for reference. I hope you can get something after reading this article.
There are two GC modes for .NET Core:
Server GC / Workstation GC
Server GC:
It is mainly used in multiprocessor systems and serves as the default configuration for ASP.NET Core hosts. It creates a GC Heap for each processor and performs recycling operations in parallel. The GC of this mode can maximize throughput and better shrinkage. The characteristic of this mode is that the initial allocation of memory is large, and the memory is not recycled as much as possible, which is time-consuming and memory defragmentation. In simple terms, this is greedy mode, which achieves better performance by getting as much memory as possible and less recycling. The result is better performance with high memory usage.
Workstation GC:
Mainly used in single-processor systems, Workstation GC improves performance by reducing the number of pauses during garbage collection as much as possible. Applications that are low-load and do not often perform tasks in the background, such as services, can use workstation garbage collection with concurrent garbage collection disabled. It is characterized by frequent recycling to prevent a longer period of recycling. The result is poor performance with low memory usage.
Simple test
The following test results are all on the same computer and are configured as follows:
Windows 7 Ultimate
Intel Core I3-3220 @ 3.30 GHZ
8 GB of memory, free space 3GB
SQL Server 2014
The program being tested is ZKEACMS, home page, one-sided stress test, 5000 requests, 1000 concurrency. The test results are as follows:
Server GC:
The response result is as follows, about 167.81 Req/s. This result is not always the same, there will be some deviation, for reference only:
Memory usage has increased to about 600 MB, with ups and downs, as shown in the following figure:
After repeated tests, the maximum memory has increased to more than 800 M, which has something to do with the available memory. If more memory is available, it will rise to 1G or higher and then fall:
Workstation GC:
The response result is shown in the following figure, about 151.33 Req/s, which looks a little worse than Server GC, and the overall test results are worse.
Memory usage has been floating around 200m, repeated stress testing, there will not be major ups and downs, which has something to do with its active recycling:
Switching of memory recovery mode
Now that you have some understanding of the impact of the different memory collection modes of .net Core, it's up to you to make a choice. The default greedy mode of .net Core can get better performance, which is no problem, after all, it is a waste of memory not to be put there. Of course, if there are a lot of programs running on your server, and there are high restrictions on memory not to affect other programs, then you need to do some configuration.
Development environment
In the development environment, you can edit your project files, add the following configuration, and rebuild:
False
Production environment
You can redeploy without modification, go directly to your program and find * .runtimeconfig.json, such as ZKEACMS.WebHost.runtimeconfig.json, modify "System.GC.Server": false, and restart the program:
"configProperties": {"System.GC.Server": false} on the ".net Core memory recovery mode and performance test comparison example analysis" this article shares here, I hope the above content can be of some help to you, so that you can learn more knowledge, if you think the article is good, please share it for more people to see.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.