Memory usage with ASP.Net Core 6.0
What happened to the garbage collectors?
Hey there interactive meme mappers, I've got a bit more of a technical update regarding some server configuration I found while I noticed Famous Meme Maps was having some issues with memory usage. I think a lot of programs over allocate memory because it's cheap and plentiful these days, I notice this especially with Chrome and other web browsers. They take up gigabytes of memory but in turn they are able to handle a lot of computations rather quickly because of it. Each time a program wants some memory it needs to ask the operating system for an address to write to. If memory has already been allocated that communication isn't required and the browser (or any other app) can just stuff whatever it wants, when it wants.
I feel like that's what ASP.Net might have something like that under the hood where it scales based on resources. Famous Meme Maps is hosted on shared resources so while it looks like there's a lot of power available to the application, it's actually a much smaller piece of the pie that can be used. images.famousmememaps.com shows that the box has 8GB of ram, while famousmememaps.com has 5GB of ram. I don't pay for that amount of ram so my servers are limited to 512MB which is a far cry from what is available on the server. ASP was scaling to use more than 512MB of ram due to it trying to pre-emptively allocate memory to serve more requests quicker and more resilient. There was some XML I could put into the .csproj
to make it keep the memory usage down to a minimum. The bit I put was located in the top "PropertyGroup" node, and it's <ServerGarbageCollection>false</ServerGarbageCollection>
. Here's a StackOverflow thread about it that explains a bit more about how ASP is responding to this change.
I think that's about it, I'm trying to cater this blog towards tech enthusiasts and people who are interested in knowing more about programming. I think this could be a bit of a tangent compared to the other posts, but expect more as I figure out and find the voice for this announcements page on Famous Meme Maps. Best.