-
Notifications
You must be signed in to change notification settings - Fork 5.3k
Description
After upgrading our application, running on Ubuntu 18.04, from .NET Core 3.1 to .NET 5.0 we're seeing a consistently higher Resident Set Size memory usage.
The application normally processes web requests at a steady rate, but once per day it updates its data, which causes much higher RAM usage for 1-30 minutes. After this, we see the managed memory (as reported by GC.GetTotalMemory) drop about the same way on .NET 3.1 and 5.0. However, the Resident Set Size for the process either remains unchanged or drops gradually over the next few hours, but is still way higher than managed memory - we're talking ~6 GB reported by GC.GetTotalMemory and ~33 GB Resident Set Size.
To further confuse things, we had 3 instances of the application running at the same time on the same machine receiving the same requests. One on .NET 3.1, another on .NET 5.0 with otherwise identical code and another on .NET 5.0 with some code differences. The RSS dropped for the .NET 3.1 version and the identical .NET 5.0 version, but not the newer .NET 5 version, implying something about our code changes may have caused the difference, but I can't see what that can be when the managed memory went down the same way for all of them.
https://devblogs.microsoft.com/dotnet/performance-improvements-in-net-5/ mentions a number of GC changes in .NET 5, in particular #37894 which sounds relevant. Is there any documentation on how RSS is expected to behave in .NET 5? For example, when does the GC consider itself to be in a "low memory situation"? I was unable to find anything. Basically, what we're trying to figure out is whether this is a problem or expected behavior. If expected, the next question would then be how to tell how much RAM the server really has available to run more instances of the application.