Ok, so I have an app with pretty heavy traffic (about 17 requests per second). The app is a REST API built with .Net Core 2.0 (just recently upgraded).
The app is hosted on Azure and we are having a problem that looked like a memory leak in that the servers would very slowly (over a week) eat up all the handlers and resources and eventually crash.
I have spoken a good bit to MS Support and they helped me narrow down the problem. Here is their last email:
"We are seeing a high amount of large objects (strings and arrays over 85000 bytes) can lead to GC Heap fragmentation and thus higher memory usage in your application. We were investigating how to manage the destructor and I can provide you the following documentation:
- Why does the Finalize/Destructor example not work in .NET Core? Why does the Finalize/Destructor example not work in .NET Core? (not a Microsoft official documentation but it can be use as reference )
ASP.NET Case Study: Bad perf, high memory usage and high
CPU in GC – Death By ViewState:
https://blogs.msdn.microsoft.com/tess/2006/11/24/asp-net-case-study-bad-perf-high-memory-usage-and-high-cpu-in-gc-death-by-viewstate/
- Finalizers (C# Programming Guide):
https://learn.microsoft.com/en-us/dotnet/csharp/programming-guide/classes-and-structs/destructorsI will continue looking for more documentation related with the destructor in .NET Core."
After this they basically said that Azure was not to blame and I needed to open up a "code" support ticket that costs about $500...
So I am coming here instead. :)
While I have been a .Net developer for over 15 years, this was my first time using .Net Core. I found this great article and used it as the backbone to my API (https://chsakell.com/2016/06/23/rest-apis-using-asp-net-core-and-entity-framework-core/).
When I compared it to other .Net Core examples it seemed to fall in line with those so I am reasonably confident that I am following "best practices", but I could be wrong.
My fear is that there is a fundamental problem with .Net Core (which those articles that MS referred to kinda suggest), but I am not sure how to find the answer. I don't want have to rewrite my code because of this, but aside from occasionally rebooting the servers I am not sure what my options are.
Thoughts?