aspnetcore: asp.net core ServerGarbageCollection not working
Asp.net core 1.1.2 windows server 2016
after migrating my project from vs 2015 to 2017 i made a release and published my website but now memory usage constantly grows in production server.
At vs 2015 i had this in my project.json :
"runtimeOptions": {
"gcServer": true
},
but after migrating to vs 2017 csproj is like this
<PropertyGroup>
<TargetFramework>netcoreapp1.1</TargetFramework>
<PreserveCompilationContext>true</PreserveCompilationContext>
<AssemblyName>xxxxx</AssemblyName>
<OutputType>Exe</OutputType>
<PackageId>xxxxx</PackageId>
<UserSecretsId>xxxxxxx</UserSecretsId>
<RuntimeFrameworkVersion>1.1.2</RuntimeFrameworkVersion>
<PackageTargetFallback>$(PackageTargetFallback);dotnet5.6;dnxcore50;portable-net45+win8</PackageTargetFallback>
<ServerGarbageCollection>true</ServerGarbageCollection>
</PropertyGroup>
i also changed csproj to this in another test:
<PropertyGroup>
<ServerGarbageCollection>true</ServerGarbageCollection>
<ConcurrentGarbageCollection>true</ConcurrentGarbageCollection>
</PropertyGroup>
and runtimeconfig.template.json to this :
{
"gcServer": true,
"System.GC.Server": true,
"gcConcurrent": true
}
but garbage collection is not working. any idea what is going wrong?
About this issue
- Original URL
- State: closed
- Created 7 years ago
- Reactions: 1
- Comments: 18 (5 by maintainers)
How does the GC view the machine specs when running in a Docker container? Does every run-time think it has use of all the host resources? I ask because I’m running a number of simple APIs (microservices) on Docker on Ubuntu, and each container is consuming 500-900 Mb of memory. It’s not a powerful server - 16Gb/4 cores at the moment. CPU usage is under 5% but I’m hitting memory limits. I’ve not been able to find a solution yet. I can tell Docker to limit the memory available to each container, but what I see is that they don’t seem to use less memory, they just start using swap space, which will hurt their performance.