docker / for-win

Bug reports for Docker Desktop for Windows
https://www.docker.com/products/docker#/windows
1.86k stars 291 forks source link

Poor network performance in WSL2 #12452

Open EnricoBeltramo opened 2 years ago

EnricoBeltramo commented 2 years ago

Actual behavior

I created a docker based on Mosquitto (mqtt ethernet broker) in Win10. From an application running on OS, I communicate with that broker sending high speed and high size messages. I observed that the ethernet communication is approssimatively 10x times slower in win than equivalent structure in Ubuntu 20.04.

Expected behavior

Similar bandwith in both Win and Ubuntu

Information

Output of & "C:\Program Files\Docker\Docker\resources\com.docker.diagnose.exe" check

Steps to reproduce the behavior

  1. create a docker based on mosquitto https://hub.docker.com/_/eclipse-mosquitto
  2. create a program that send message to broker
  3. Check messages per seconds sent in both win and Ubuntu
docker-robott commented 2 years ago

Issues go stale after 90 days of inactivity. Mark the issue as fresh with /remove-lifecycle stale comment. Stale issues will be closed after an additional 30 days of inactivity.

Prevent issues from auto-closing with an /lifecycle frozen comment.

If this issue is safe to close now please do so.

Send feedback to Docker Community Slack channels #docker-for-mac or #docker-for-windows. /lifecycle stale

EnricoBeltramo commented 2 years ago

/lifecycle frozen

There are any news about this issue? The problem is still present

EnricoBeltramo commented 2 years ago

/lifecycle frozen

jitbasemartin commented 2 years ago

A workaround seems available here (not tested): https://github.com/microsoft/WSL/issues/4901#issuecomment-1094226888

eritpchy commented 1 year ago

Workaround:

image
  1. Disable Docker Desktop WSL intergration
  2. Install systemd inside WSL https://github.com/nullpo-head/wsl-distrod
  3. Install docker inside WSL https://docs.nvidia.com/datacenter/cloud-native/container-toolkit/install-guide.html

Result:

image

before

image

after

michal-korniak-kornit commented 9 months ago

Hi. Is there a chance that this issue will be resolved soon? I followed @eritpchy suggestion, and it significantly improved network performance. Here are my results:

Host to host: 11.5 Gbits/sec Host to server on Docker (custom Docker installation in WSL distro): 5.54 Gbits/sec Host to server on Docker (Docker Desktop): 853 Mbits/sec

P.S. I don't know if it makes a difference, but I installed Docker on the WSL distribution using a slightly different approach: https://linuxhint.com/run-docker-in-wsl-without-docker-desktop/.

ericblade commented 8 months ago

So... it's been a few years on this, and ... curious if anyone's made any headway on figuring out what might be at issue here?

Docker Desktop with WSL2 backend seems to have an absolutely maximum throughput across all containers, of 100mbps, and usually a lot less. I have a 1.2gbps link to the rest of the world, but Docker on WSL2 can only use about 1/12th of it.

It seems unrelated to the wsl2 slow network problem, which is just a significant slowdown from maximum, most of the time, but does not seem to be a hard cap. Whether I'm pulling 200mbit or 800mbit in bare WSL2, I'm always capping at 100mbit in docker.

starkgate commented 2 months ago

This reply worked for me: https://github.com/microsoft/WSL/issues/4901#issuecomment-1933155508