I have been migrating a lot of services to Azure Linux, because I have the assumption Linux is more lightweight. Now I noticed almost all these microservices jumped from around 50mb to 300mb. A lot of them don't use a lot of caching.
Is that normal? Is this like a hefty price for the .NET runtime or something that is included and might be shared on the infrastructure on Windows? Is this a static penalty or does the memory scale worse on Linux (not sure how that should work).
Note that I was running on plain Azure Web Apps - not in Docker. Can this be Docker related?
To answer questions in the comments:
- running C# .NET Core (ASP.NET Core MVC)
- they are just Azure Web Apps
- these apps do VERY little
- no Mono
- just recompiled and published to Azure Linux instead of Azure Windows Web App
Basically everything exact the same except that I used Visual Studio to publish to a Linux Web App instead of a Windows-based Web App. I can run them side by side by just republishing them to a different Web App and will see a memory difference of about +200 mb using Process.GetCurrentProcess().PrivateMemorySize64
.
Update I just uploaded an almost empty ASP.NET Project:
public class Startup
{
public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
{
app.UseRouting();
app.UseEndpoints(endpoints =>
{
endpoints.MapGet("/", async context =>
{
double size = Process.GetCurrentProcess().PrivateMemorySize64;
string size_str = Math.Round( size/ (1024*1024) ) + "mb";
await context.Response.WriteAsync( size_str );
});
});
}
}
- Vanilla Windows 64bit Azure Web app: about 53 mb
- Vanilla Linux (64bit?) Azure Web app (docker based as far as I understand): 165 mb