Open ralish opened 1 year ago
One thought: a simple way to fix this may be to just access the required files over the Plan 9 network filesystem? For example, read from \\wsl$\docker-desktop\proc\meminfo
. This can be done directly from within the com.docker.backend.exe
process.
I am also experiencing this
There hasn't been any activity on this issue for a long time.
If the problem is still relevant, mark the issue as fresh with a /remove-lifecycle stale
comment.
If not, this issue will be closed in 30 days.
Prevent issues from auto-closing with a /lifecycle frozen
comment.
/lifecycle stale
Still definitely an issue. Most recently tested on Docker Desktop v4.17.0.
/remove-lifecycle stale /lifecycle frozen
Just noticed this problem as well. Still an issue on Docker 4.17.1.
I am experiencing this issue as well
Bumping this as it feels like an easy win relative to the performance benefit. Would be nice to get at least some comment from the Docker Desktop team.
My environment has some security software that uses a lot of CPU whenever a process is created, so Docker Desktop is making the fan scream.
There are much better ways to get such basic metrics as opposed to shelling processes in a loop...
I am seeing the same issue using wsl image created with podman
Actual behavior
Docker Desktop spawns a very high number of processes during operation, including while in the background with no user containers running. These processes appear to be for the purpose of collecting resource usage data from the WSL environment.
Sampling over a 1 minute interval, Docker Desktop spawns 36
wsl.exe
processes, each of which in turn spawn 3 additional processes, for a total of 144 processes. Extrapolating to an hour, that means Docker Desktop is spawning 8,640 processes just to collect resource usage information. The true number is higher, as there are other apparent processes spawned for similar purposes (e.g.powershell.exe
) but they are far less frequent in frequency.The
wsl.exe
command is being spawned with two specific invocations:wsl.exe -d docker-desktop cat /proc/meminfo
(~5 seconds, 12 per minute)wsl.exe -d docker-desktop cat /proc/stat
(~2 seconds, more variance, but equals 20 per minute)For each of these invocations, another three processes are spawned so that the process tree looks like this:
The second invocation of
wsl.exe
underWindowsApps
is I expect due to this system using the newer Windows Store based WSL. If you're using the inbox WSL included with Windows, this probably doesn't spawn and the initialwsl.exe
underSystem32
presumably just launcheswslhost.exe
directly (except underC:\Windows\System32\lxss\wslhost.exe
). So eachwsl.exe
invocation is slightly more efficient, with only two child processes spawned instead of three.Expected behavior
Docker Desktop should take a more efficient approach to collecting resource usage data from WSL that isn't so resource intensive. Process creation under Windows is generally much more "expensive" than under Unix-like platforms. While recent Windows releases have made improvements, it's still not at all comparable in performance to Unix-like systems. The impact of constantly spawning so many processes is sure to be material, and it's especially sub-optimal given this is while Docker Desktop is simply in the background with no user containers running (i.e. it should be effectively "idle").
Information
The problem should be reproducible on any system with WSL installed and using the WSL 2 backend. I'm not clear if Docker supports WSL 1, and if it does, I haven't tested it. Using the latest WSL release from the Windows Store will further exacerbate the issue, but it's present using the inbox WSL shipped with Windows itself.
Output of
& "C:\Program Files\Docker\Docker\resources\com.docker.diagnose.exe" check
Steps to reproduce the behavior
wsl.exe
processes (e.g. Process Monitor)