RAM usage of .NET Blazor app in Docker container


I am using TorizonCore -5.7.0 and Verdin iMX8M Mini SoM and I am writing ASP.Net app (Blazor app x64 in .Net 6 framework) that runs in docker container. The first issue that I encountered was with excessive usage of RAM memory in the system. When i create simple hello world Blazor application that is doing nothing I am getting around 1GB of memory usage reported with command cat /proc/meminfo in Linux, and I do not know if that is normal.
Also, after some testing i added background service that reads some data and saves it in the database and I discovered that my RAM usage constantly rises to the point of crashing application or even whole Linux. Is there any solution in case the kernel crashes something important if RAM usage is at maximum like whole Linux or my container where is application.

Best regards,

Greetings @fvodopive,

In my experience Blazor can be a relatively heavier framework, so such memory consumption isn’t too out of place. This is also taking into account that running such a web app requires a browser if running locally, which will further increase the memory consumption. Though using a more lightweight browser like Cog instead of Chromium can help.

Is there any solution in case the kernel crashes something important if RAM usage is at maximum like whole Linux or my container where is application.

I’m not sure if I understand what you are asking here. You can limit the amount of memory that is available to a single container. That way it doesn’t consume all the memory on the system. More information on this here: Docker run reference | Docker Documentation

Though then your container/application will probably throttle or crash on it’s own, which isn’t too much better.

Best Regards,

Hi @jeremias.tx

Thank you for advice with limiting the amount of memory available to a single container. But i want to know if there is any mechanism that in case of kernel crash of any kind would reboot Linux every time so I do not have to worry if something goes bad my Linux would not reboot.

Best Regards,

Hi @fvodopive ,

could you share with us the versions of the packages that you are using in your project? Also, could you tell if are you using some of our templates from VS Code extensions? If positive, then could you share the extension version?

I would like to understand better or try to reproduce a similar scenario, although Blazor not being the lightest framework, I don’t think it’s normal for this excessive RAM usage to reach a point of breaking the system.

Best Regards,

Hi @matheus.castello,

You did not understand me I made additional application that on purpose cause excessive RAM usage just to see what happens and i managed to break the system. I was just asking if you have any solution if system breaks. Example some mechanism to reboot Linux.

Best Regards,

Ok wait so just to clarify, when your system crashes due to excessive RAM usage, what happens? I would expect it to reboot. We do have a watchdog that should be enabled by default: Watchdog (Linux) | Toradex Developer Center

This should reboot the system if something causes systemd or the kernel to hang or such.

Best Regards,