Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

What is the impact of .NET Core configuration on GC operating mode and memory

2025-02-27 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)06/01 Report--

This article will explain in detail about the impact of .NET Core configuration on GC working mode and memory. The content of the article is of high quality, so the editor will share it with you for reference. I hope you will have some understanding of the relevant knowledge after reading this article.

Lead to the problem: analysis of excessive memory utilization of Asp.net core applications on Kubernetes

By default, the ASP.NET Core program runs in the Docker of K8s with memory utilization > = 600MB, causing the Docker container to restart frequently. After setting the ASP.NET Core project configuration System.GC.Server to False, the memory is less than 4 logical CPUs32 MB2 GBServer GC with > 8 logical CPUs16 MB1 GB.

Segment includes second-generation objects, which apply to memory as much as possible when memory permits, and use multiple segments for memory storage.

The amount of memory released from GC is limited to the size of Segment, but because Segment is allocated with dynamic size, a large amount of memory space after release leads to low memory utilization. As mentioned earlier, in order to solve this problem, GC needs to defragment memory and interrupt the processing of all threads.

Several configuration modes of .NET Core GC: Concurrent & Workstation GC

Copyfalse

True

Features: find a balance between throughput and corresponding speed, the number of GC Heap is 1 GC Heap GC threads in the allocation of space threads, GC thread priority and worker thread have the same priority, worker thread (non-GC thread) will hang for a short time during GC work.

Background & Workstation GC

Copyfalse

False

Features: maximize throughput and optimize gen2 GC performance, the number of GC Heap is 1. GC Heap background GC threads have the same priority as worker threads, but both are lower than foreground GC threads. Worker threads (non-GC threads) will hang for many times during GC work, which is better than concurrent performance (for Gen2).

Concurrent & Server GC

Copytrue

True

Features: multiprocessor machines use multithreading to process the same type of requests in order to maximize server throughput, the number of GC Heap is 1 per processor, each processor has a full-time GC thread, GC thread has the highest thread priority, worker threads (non-GC threads) will be suspended because of GC work.

Background & Server GC

Copytrue

False

Features: optimize gen2 GC performance on the basis of Concurrent & Server GC. The number of GC Heap is 1 per processor, and each processor has a full-time GC background thread. The background GC thread has the same priority as the worker thread, but both are lower than the foreground GC thread. The worker thread (non-GC thread) will hang for many times because of the GC working process, which is better than the concurrent performance (for Gen2).

The foreground GC of ephemeral generation suspends all other threads while working.

So much for sharing the impact of .NET Core configuration on the working mode and memory of GC. I hope the above content can be of some help and learn more. If you think the article is good, you can 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.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report