dotnet / runtime

.NET is a cross-platform runtime for cloud, mobile, desktop, and IoT apps.
https://docs.microsoft.com/dotnet/core/
MIT License
15.28k stars 4.74k forks source link

NET7.0 use memory,linux > windows,so much~~~~~ more,why #86749

Open snltty opened 1 year ago

snltty commented 1 year ago

Description

same application

windows

linux working set so large linux

Configuration

windows x64 linux debian x64

Regression?

Data

Analysis

huoyaoyuan commented 1 year ago

Can you provide some information about your application? For example what it's doing and how it's allocating objects.

snltty commented 1 year ago

Gen 0,Gen 1,Gen 2。no problem,i don't know working set come from,why that need 78MB

ghost commented 1 year ago

This issue has been marked needs-author-action and may be missing some important information.

MSDN-WhiteKnight commented 1 year ago

Is the "Working set" value on Linux a private working set, or includes memory shared with other processes (such as executable images for libraries loaded into multiple processes)? What tool generated this output?

snltty commented 1 year ago

Is the "Working set" value on Linux a private working set, or includes memory shared with other processes (such as executable images for libraries loaded into multiple processes)? What tool generated this output?

dotnet-counters

project /snltty/p2p-tunnel

client/client.service or server/server.service

danmoseley commented 1 year ago

Cc @mangod9

mangod9 commented 1 year ago

Hello @snltty, would it be possible to provide a small repro for this? There are several factors which might affect working set, but primarily it would be related to amount of memory and # of cores on the machine/VM. Are both machine configurations similar for windows and linux? Also would be good to know what version of .NET you are using for this validation?

Thanks

snltty commented 1 year ago

Hello @snltty, would it be possible to provide a small repro for this? There are several factors which might affect working set, but primarily it would be related to amount of memory and # of cores on the machine/VM. Are both machine configurations similar for windows and linux? Also would be good to know what version of .NET you are using for this validation?

Thanks

.NET 7.302 windows CPU: i5 8400,Memory:8G 3600 * 2 linux CPU:intel N2840,Memory:4G 1333 linux already set DOTNET_GCName=libclrgc.so

mangod9 commented 1 year ago

thanks for the info. Are you observing this with a simple helloworld style application or specifically for your application (would it possible to provide a repro?)

Also with the latest .NET 7 servicing release falling back to .NET 6 GC is no longer required. We have fixed the spurious 64mb of working set issue.

snltty commented 1 year ago

thank you,i will try simple helloworld application

snltty commented 1 year ago

code

3

windows 3.1MB

linux

1 2

mangod9 commented 1 year ago

Ok thanks we will take a look. Is the windows number working set or "active private working set" in Task Manager (I notice about 25k working set for a simple HW app on my windows machine). Perhaps you should check with dotnet-counters as well on Windows to ensure you are looking at the same metric.

snltty commented 1 year ago

windows

windows-runtime windows-memory windows-working-set

linux 2 cores 4GB 1333

linux linux-runtime dotnet-memory dotnet-working-set

mangod9 commented 1 year ago

@janvorli to check since we recently did some analysis around working set on linux. @snltty, assume you are running the same app on both machines? Your earlier screenshot from few days ago shows working set of 37mb, but the recent one is 84mb -- what is different?

janvorli commented 1 year ago

It seems that windows probably don't include assemblies and shared libraries in the value reported by the taskman. When we did the testing with a simple Web app, the managed assemblies alone consumed about 32 mb, then there were about 10MB from the native libraries of the .NET runtime and 11MB from 3rd party native libraries. The hello world would get somehow smaller numbers.

snltty commented 1 year ago

@mangod9 , 5day ago,37MB is simple hello world 34MB and 78MB,is my project in Windows and Linux

It seems that the working set used by Linux is always larger than that of Windows,a lot,i don't know why

Perhaps this is the normal situation?

My project just to using 1