microsoft / WSL

Issues found on WSL
https://docs.microsoft.com/windows/wsl
MIT License
17.55k stars 823 forks source link

Very slow network speed on WSL2 #4901

Open carl-berg opened 4 years ago

carl-berg commented 4 years ago

Windows build number: 10.0.19041.84 Dist: Ubuntu 18.04 LTS

I just installed WSL2 on my home computer for the first time and something i notice that i don't see on my work computer is that WSL2 has dramatically lower network speed (wget or git clone tested). Speeds on WSL seem to be about 10-20 kb/s wheras windows download speed seem to be correlating to my ISP spec of 100/10 Mbps or above.

therealkenc commented 4 years ago

Screencap speedtest-cli as a starting point.

$ sudo apt install speedtest-cli
$ speedtest-cli
[...]

image

carl-berg commented 4 years ago

Okies, here's speedtest on windows, in the browser: Speedtest_win

...and here's speedtest from wsl2: Wpeedtest_wsl2

acirulis commented 4 years ago

Same here. Especially upload speed was drastically reduced - 36.61 -> 3.85 Mbit/s

guilhermehrcosta commented 4 years ago

Hi, same here. My download was drastrically reduced of 200Mbit/s to 2 Mbit/s. Is there a solution?

AndrewGaspar commented 4 years ago

I'm hitting this issue, as well. Very frustrating.

kennethnipper commented 4 years ago

I'm seeing same issue. Speedtest-cli in bash: image

speedtest in Windows: image

tin-liu commented 4 years ago

Edit: After several reboots and adding the related folders as exceptions in Windows Defender as @jituanlin 's referred blog pointed out, and then tried removing the exceptions because I wanted to check which folder exception actually helped (so eventually theoretically equivalent to reboots-only, but who knows?), now in WSL Ubuntu Ver. 2 I have down = ~80 Mbit/s & up = ~4 Mbit/s. The upload is still about only 1/10 of the actual limit, but the download is up-to-standard now.

Also, the command speedtest is ~15 Mbit/s faster (download) than speedtest-cli for me.

Old comment: Windows network faster than WSL Ubuntu Ver. 1 which faster than WSL Ubuntu Ver. 2 here:

  1. Windows Ookla on Web browser down ~88 Mbit/s up ~38 Mbit/s
  2. WSL Ubuntu Ver. 1 speedtest-cli down ~32 Mbit/s up ~4 Mbit/s
  3. WSL Ubuntu Ver. 2 speedtest-cli down ~3 Mbit/s up ~4 Mbit/s

Cheers

jituanlin commented 4 years ago

After follow this blog My network/file access improve more than 5 times speed.

rducom commented 4 years ago

Same here, really annoying. Disabling AV (defender) doesn't helps image

markgaze commented 4 years ago

Same here. Getting about 7Mbit/s on WSL2 and 30+ in Windows.

Disabling Defender also made no difference for me either.

Vildevil commented 4 years ago

Same here : Windows and WSL :

WSL 2 :

copeland3300 commented 4 years ago

Oddly, I'm getting decent results from the speedtest-cli, but things such as apt update are extremely slow, that is, less than a MB/s, where I'm used to seeing 30-40MB/s on my standard Ubuntu systems...

Speedtest results...

Retrieving speedtest.net configuration...
Testing from Verizon Fios (108.28.56.14)...
Retrieving speedtest.net server list...
Selecting best server based on ping...
Hosted by QTS Data Centers (Dulles, VA) [5.59 km]: 27.576 ms
Testing download speed................................................................................
Download: 427.07 Mbit/s
Testing upload speed......................................................................................................
Upload: 85.70 Mbit/s

apt update results

Get:1 http://security.ubuntu.com/ubuntu focal-security InRelease [107 kB]
Hit:2 http://archive.ubuntu.com/ubuntu focal InRelease
Get:3 http://archive.ubuntu.com/ubuntu focal-updates InRelease [107 kB]
Get:4 http://archive.ubuntu.com/ubuntu focal-backports InRelease [98.3 kB]
Get:5 http://archive.ubuntu.com/ubuntu focal-updates/main amd64 Packages [94.0 kB]
Get:6 http://archive.ubuntu.com/ubuntu focal-updates/universe amd64 Packages [30.5 kB]
Fetched 437 kB in 2s (197 kB/s)
oliver-dungey commented 4 years ago

Same issue here, dire network speed in WSL2. Performance with Linux or WSL is fine.

aleled commented 4 years ago

I am experiencing the same

Speedteswt from WSL are poor compared to CMD

1

mrorat commented 4 years ago

Same here, Windows is about 60Mbps vs WSL2 14kbps !!!!

arthurgeron commented 4 years ago

I think it's useful to let people know that this doesn't happen to everyone, I'm getting my full speed here in WSL 2 on Windows 10 2004 (non Insider) image

didinele commented 4 years ago

Much more interesting for me!

On windows image

Over on my freshly intalled WSL2 image

Seems like download speed remained rather intact, however upload was heavily hit.

Windows 10 Enterprise version 2004, Ubuntu 18.04 LTS`

rarora7777 commented 4 years ago

I'm seeing 249.94mbps down / 15.42mpbs up on Windows, which is pretty much what I expect from my ISP. On WSL2, sppedtest-cli shows 4.69mbps down / 3.29mbps up.

But apt and git performance in WSL2 is so much worse. I'm getting download speeds of 4–16 kbps on both.

~I don't recall measuring network speed on WSL1, but such terrible performance would have been quickly noticed.~ Edit: Just installed a WSL1 Ubuntu 20.04 LTS and I got 193.61 mbps down / 16.94 mbps up.

I'm on Windows 10 Enterprise version 2004 (build 19041.264) and Ubuntu 18.04 LTS that I recently upgraded to WSL2.

BeErikk commented 4 years ago

Just FYI. I have experienced extremely slow network speed as well, but it seems to be a temporary issue. Perhaps a local network issue? Right now in WSL 1 (2004 not insider) I get:

speedtest-cli
Retrieving speedtest.net configuration...
Testing from AllTele (XX.XX.XX.XXX)...
Retrieving speedtest.net server list...
Selecting best server based on ping...
Hosted by A3 Allmänna IT - och Telekomaktiebolaget (Stockholm) [162.45 km]: 12.928 ms
Testing download speed................................................................................
Download: 124.83 Mbit/s
Testing upload speed......................................................................................................
Upload: 122.34 Mbit/s
JennToo commented 4 years ago

I was having a similar issue and found that switching from Wifi to Ethernet helped. I don't really understand why, as speedtests over my Wifi are fine outside of WSL2. I suppose it's possible that the Ethernet driver is somehow interacting with WSL and/or HyperV better.

Ethernet NIC is a "Killer E2500 Gigabit" WiFi is a "Killer Wireless n/a/ac 1535" (though the only thing it seemed to "Kill" was my network performance 😄)

dvsmaxv commented 4 years ago

Hello friends, I'm not good at English, But me too I faced the same issue and I tried so many time and finally I got one solution and here's the url: https://www.hitxp.com/articles/software/ubuntu-fix-slow-wireless-internet-connection-speed-upgrading-11-04-natty-narwhal/. With sample pic

Screenshot from 2020-06-09 22-05-31

matze19999 commented 4 years ago

don't have the problem on surface pro x (arm64)

mrorat commented 4 years ago

It gets better... my speedtest today (Ethernet): WSL2: Download: 45.98 Mbit/s Upload: 3.39 Mbit/s

Windows: Download: 46.5 Mbit/s Upload: 17.8 Mbit/s

takizo commented 4 years ago

Hi all, I got the latest Windows 10 ver 2004 update. Switching from WSL1 to WSL2. I have the similar slow issue like you all had. But not particularly on the internet, it's more on Windows to Ubuntu via localhost access

Windows Version: 2004 Build: 19041.264 Ubuntu: 18.04.4

I run php development in WSL with Ubuntu 18.04.4, I have apache2, php7.2 and MariaDB running very well on WSL1

During development, I usually tunnel to my server to load ElasticSearch/Postgresql data, the tunnel is listen on localhost with respective port numbers.

I do not have connection problem when running in WSL1, the speed is tremendous fast. It's fast like the data is loading on my machine itself.

But when I switch to WSL2, I notice the connection is extremely slow. The initial loading took like 5-7 secs. Then the page would rendered. The hostname is mapped to 127.0.0.1, I've tried mapped on WSL2 Ubuntu private IP, the results are the same - Slow.

I've capture the video and sharing with you all.

Here is the video running on WSL1

https://www.youtube.com/watch?v=tNFtUUd2sG4

What I did was wsl --set-version Ubuntu 2, to upgrade the current Ubuntu distro to WSL2. Here is the video of the same development site running on WSL 2 (Please look at left bottom status bar)

https://www.youtube.com/watch?v=JFYgzMHf2RU

I've tried the comments on this thread, no luck getting it load fast like WSL 1. Hopefully this can be fixed,

I've switched back to WSL1 and the speed is back to normal. You may refer to the video below, the result is instance.

https://www.youtube.com/watch?v=9Q5Ors94lJM

takizo commented 4 years ago

Hello friends, I'm not good at English, But me too I faced the same issue and I tried so many time and finally I got one solution and here's the url: https://www.hitxp.com/articles/software/ubuntu-fix-slow-wireless-internet-connection-speed-upgrading-11-04-natty-narwhal/. With sample pic

Screenshot from 2020-06-09 22-05-31

I've tried made changes on nsswitch and even change resolve.conf to 1.1.1.1 and 8.8.8.8. It doesn't help either.

pankerit commented 4 years ago

Hello microsoft!!! do something or tell as how to speed it up :(

0xTimepunk commented 4 years ago

Any clue how to solve this? I am lost

elmaynard commented 4 years ago

@takizo Mine was already set to that without any modifications. I have 0.82Mbit/s when running speedtest for download, and weirdly 21.57 Mbit/s for upload. It's unuseable.

erfantkerfan commented 4 years ago

+1

paulikappi commented 4 years ago

set virtualization on from bios settings

0xTimepunk commented 4 years ago

set virtualization on from bios settings

This is not the solution...

After follow this blog My network/file access improve more than 5 times speed.

Following the first tip in this link (adding the folder to the list of exceptions of windows defender) seems to do the trick

Any WSL dev can have a saying on this?

paulikappi commented 4 years ago

I got more speed after enabling virtualization from bios, enabled wsl2 and reinstalled ubuntu distro.

vecchp commented 4 years ago

I found this post https://social.technet.microsoft.com/Forums/windowsserver/en-US/e2ff174e-0e66-4004-beb9-cfccfe7fd4d4/hyperv-virtual-network-setting-slow-internet?forum=winserverhyperv

It suggested disabling large send offload in the vEthernet network adapter created for WSL. Seems to have resolved any major slowdowns I'm running into.

0xTimepunk commented 4 years ago

I found this post https://social.technet.microsoft.com/Forums/windowsserver/en-US/e2ff174e-0e66-4004-beb9-cfccfe7fd4d4/hyperv-virtual-network-setting-slow-internet?forum=winserverhyperv

It suggested disabling large send offload in the vEthernet network adapter created for WSL. Seems to have resolved any major slowdowns I'm running into.

Confirmed working

takizo commented 4 years ago

I found this post https://social.technet.microsoft.com/Forums/windowsserver/en-US/e2ff174e-0e66-4004-beb9-cfccfe7fd4d4/hyperv-virtual-network-setting-slow-internet?forum=winserverhyperv

It suggested disabling large send offload in the vEthernet network adapter created for WSL. Seems to have resolved any major slowdowns I'm running into.

Thanks for sharing this tips. I disabled Large Send Offload both v4 and v6 on the network adapter "vEthernet (WSL)" . This resolve the slowness access on my WSL development environemnt at localhost 👍

image

brcarey commented 4 years ago

Anyone know if there is a way to make this permanent? Seems I have to set it again every time I start the distro?

therealkenc commented 4 years ago

Anyone know if there is a way to make this permanent?

I suspect that is another spiritual variation #4139 (message) aka #4467 #4210 et al.

CristianoPassos commented 4 years ago

Same issue.

chrisheil commented 4 years ago

[From @takizo] I disabled Large Send Offload both v4 and v6 on the network adapter "vEthernet (WSL)"

This worked for me. Thanks!

vaishnavm217 commented 4 years ago

Same Problem here. Any fix for home edition as Hyper-V is not present for Win 10 home

vecchp commented 4 years ago

Same Problem here. Any fix for home edition as Hyper-V is not present for Win 10 home

I believe the WSL virtual adapter should still be visible under network connections even if you have home.

vaishnavm217 commented 4 years ago

Nope. I can't see it in my connections.

takizo commented 4 years ago

Nope. I can't see it in my connections.

What do you see on the list of adapters?

image

vaishnavm217 commented 4 years ago

I just have Bluetooth, Ethernet, wifi and VirtualBox Ethernet

thinkjrs commented 4 years ago

I found this post https://social.technet.microsoft.com/Forums/windowsserver/en-US/e2ff174e-0e66-4004-beb9-cfccfe7fd4d4/hyperv-virtual-network-setting-slow-internet?forum=winserverhyperv

It suggested disabling large send offload in the vEthernet network adapter created for WSL. Seems to have resolved any major slowdowns I'm running into.

This solution substantially increased localhost performance for me. Also note, I am not and have not had issues with external network performance, as many are posting here. Furthermore, disabling large send offloads to TCP didn't impact my external speeds, upload or download.

onomatopellan commented 4 years ago

@vaishnavm217 In Device Manager I have it as "Hyper-V Virtual Ethernet Adapter #2". To know the exact name you can do ipconfig.exe /all when having a WSL2 distro running.

nicknish commented 4 years ago

I found this post social.technet.microsoft.com/Forums/windowsserver/en-US/e2ff174e-0e66-4004-beb9-cfccfe7fd4d4/hyperv-virtual-network-setting-slow-internet?forum=winserverhyperv It suggested disabling large send offload in the vEthernet network adapter created for WSL. Seems to have resolved any major slowdowns I'm running into.

This worked for me. Given that the link that the author of the forum post is now down and I've spent all day trying to get this to work, here are the steps to getting this to work for you. 🤞

This method fixed ~10kbps download speeds which made WSL 2 unusable. I now have ~15mbps which is still slower than normal, but workable.

Note: This is for WSL 2. WSL 1 should not have these issues afaik.

  1. Open Ubuntu (or your other distro)

  2. Open Network Connections in your settings ("View network connections" in Windows search)

  3. You should see

    vEthernet (WSL) Enabled Hyper-V Virtual Ethernet Adapter

  4. Right-click and open Properties

  5. In the Properties pane, click Configure...

  6. In the Configure pane, go to the "Advanced" Tab

  7. Click on "Large Send Offload Version 2" and update the value to "Disabled"

    If you see two "Large Send Offload Version" options, disable both.

Additionally, it is recommended that you install any projects, packages, etc. to your Linux file system.

  1. In your Ubuntu/other cli, navigate to your Linux file system with cd ~
  2. Sanity-check you're in your Linux file system by using the command explorer.exe .. This should open File Explorer inside Network > wsl$ > Ubuntu (or other) > home > user

You're now in your Linux file system which is distinct from your Windows file system. The docs recommend staying within the Linux file system as its far faster. This is an understatement. It's a massive performance improvement.

From here, I'd recommend creating a directory like repos and installing your Git repos there to reduce future confusion.

Good luck!

jonshipman commented 4 years ago

For me with Windows on ARM and WSL2, the vEthernet (WSL) did not work. What worked was instead of using localhost I used the local IP address. 172.29.xx.xxx in the browser.

jnewcs commented 4 years ago

@jonshipman using the local IP address also worked for me! I thought maybe it was just slow.

I'm on Windows on ARM with WSL2 too.

shaul75 commented 4 years ago

Can Microsoft provide a permanent fix for this? I've had the same issue and disabling 'Large Send Offload Version' immediately solved it.