-
Notifications
You must be signed in to change notification settings - Fork 290
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[ASPNET Core] Memory Usage / GC Thrashing #1270
Comments
Reproduction is here: |
I see the same thing on my machine with that repro. The GCs are caused by LOH allocations, which in my case come from System.Diagnostics.PerformanceMonitor.PerformanceCounterLib.GetData(). The byte array coming back is huge:
|
With the following changes (based on the discussion in https://github.com/microsoft/ApplicationInsights-aspnetcore/issues/912) I'm not seeing this go over 50 MB where as before these changes it was hitting 500 MB. app.csproj <PropertyGroup>
<TargetFramework>netcoreapp2.2</TargetFramework>
+ <ServerGarbageCollection>false</ServerGarbageCollection>
</PropertyGroup> runtimeconfig.template.json {
"configProperties": {
"System.GC.RetainVM": false
}
} Changing each of the |
@cijothomas can you take a look and comment? |
Thanks for reporting the issue with repros. Yes this is easy to repro, and reproes in all sdk versions, and in both .net core and .net framework apps. This is not a bug inside the sdk itself, but from the perfcounter library. Trying to find owners to get this tracked/fixed appropriately. |
Hi @cijothomas - I recognise this isn't an issue in AppInsights directly, but net result is this is slowing our devs down, so we're yanking AI out. |
@cijothomas do you any update on this? |
@cijothomas , assigned to you to check on the status of your conversation with the code owners. |
This looks exactly like the issue I'm facing and describe here |
@evilpilaf This issue is arising from PerformanceCounter. |
Seeing the same on .NET Core 3.1 and If you don't need the AppInsight collected metrics you can disable that module in your
Obviously this is a work-around till the real issue is resolved but it works for us since we're gathering similar metrics at our hosting layer. |
This is fixed #1694 from 2.14.0-beta1 onwards. |
@cijothomas - can you please confirm the exact version of the framework this fix went into. We have current production apps that suffer from similar issues to those mentioned by @evilpilaf and they are on runtime 3.1.112 (build agents are on SDK v3.1.404). |
Fairly basic ASPNET Core Application, 1 minute after booting sitting there idling, there is a huge amount of GC thrashing and the memory is nearly peaking at 600mb:
Compared with if AI is not enabled, no GC thrashing, memory usage at 150mb:
Only difference is:
services.AddApplicationInsightsTelemetry();
The text was updated successfully, but these errors were encountered: