GC never collects anything, help me understand #53526
Replies: 1 comment 2 replies
-
Closing as I found another workaorund. |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
I'm trying to understand high memory usage of an ASP.NET app (net8), looking at these dotnet-counters results:
Running on a 16gb RAM Linux machine
As you can see the app consumes 4.6GB of RAM.
The LOH size is only 239 M, Gen2 is also small, so it's not the "Large objects" that causes high memory usage.
I ran
dotnet-trace
withgc-collect
profile for 30 seconds and found the Garbage collection never happens, ever.If I keep the app running the mem usage will grow to 7, 8,10,12GB...
I guess the GC is waiting for the "Gen 0 Budget" to fill up and then trigger the collection? The "budget" is set to 5 gigabytes, however gen0 is using only 670MB, so it will take a while to get there.
Running the same app on a smaller server with twice less memory consumes only 4GB or RAM and stays there. So I'm assuming the GC heuristics is simply "oh we have plenty or memory, let's not do anything". Is there a way I can decrease the "budget"? Or may be it would make sense to switch to "workstation" GC mode?
P.S. Can't really take a process dump cause this is a live production app. However I guess I don't need to, memory grows b/c GC never collects.
UPDATE
After switching to "Workstation" GC mode, the memory usage grows to 1GB and sits there. So I guess that helped. However, I'm not sure that "Workstation" GC mode is the best solution for a high-load web app.
I'm not sure what to do now. Leave it at workstation and experience higher CPU load caused by more frequent GC interruptions, or switch back to "Server" and pray that my app won't be shut down by Linux OOM killer? (already happened a couple of times)
Beta Was this translation helpful? Give feedback.
All reactions