2

For the last two months I've (tried to) embraced WSL2 as my main development environment. It works fine with most small projects, but when it comes to complex ones, things start to slow down, making working on WSL2 impossible. With complex one I mean a monorepo with React, node, different libraries, etc. This same monorepo, on the same machine, works just fine when running it from Windows itself.

Please note that, when working on WSL2, all my files are in the linux environment; I'm not trying to access Windows files from WSL2.

I've the latest Docker Desktop installed, with WSL2 integration and kubernetes enabled. But the issue persists even with Docker completely stopped.

I've also tried to limit the memory consumption for WSL2, but that doesn't seems to fix the problem.

My machine is an Aero 15X with 16GB of ram. A colleague suggested upgrading to 32GB of ram. But before trying this, or "switching back" to Windows for now, I'd like to see if someone has any suggestions I could test out.

Thanks.

One of the many errors VS Code throws

Erwol
  • 1,911
  • 2
  • 23
  • 28
  • Does this answer your question? [docker on wsl2 very slow](https://stackoverflow.com/questions/62154016/docker-on-wsl2-very-slow) – wxz Mar 26 '21 at 13:13
  • Not a duplicate of that question, as the OP mentions (1) the problem persists even when not using Docker (the question you linked to), (2) already having tried limiting the memory, (3) That the problem persists even when all files are in the ext4 fs. – NotTheDr01ds Mar 26 '21 at 15:13
  • 1
    @Erwol It's not clear to me what the image you posted has to do with "things start to slow down". Also, can you provide some more details on "things start to slow down" - Any timings to compare between the two environments, etc.? Is the performance degradation throughout Windows (including VSCode)? Or is it isolated to WSl and the project you are trying to run? I'm not sure that I'm going to have a good answer for you, but it might help anyone else looking at this to offer suggestions. – NotTheDr01ds Mar 26 '21 at 15:15
  • Hi @wxz, and thanks for your answer. Unfortunately that doesn't solve my issue.However, today I'm monitoring my WSL after having disabled the `Use the WSL 2 based engine` docker desktop option. That dropped WSL 2 memory consumption from 10GB to 1GB (idle), and it's CPU consumption from almost 90% to 1%. – Erwol Mar 29 '21 at 13:15
  • @NotTheDr01ds sorry for the late answer. The performance degradation propagates to the entire system as WSL2 starts taking 100% of the CPU + 100% of it's allowed RAM. As I just mentioned above it seems like using the Hyper V docker backend instead of the WSL2 one seems to help improve the overall system performance. – Erwol Mar 29 '21 at 13:20

1 Answers1

0

The recent Kernel version Linux MSI-wsl 5.10.16.3 starts slower than previous overall.But the root cause can be outside WSL: if you have a new NVIDIA GeForce card installed Windows gives it to eat as much memory as it can, i.e 6-16 Gb without using it. I had to limit WSL memory to 8Gb to start WSL service without OoM. Try to play with this parameter in .wslconfig in your home directory and look at the WSL_Console_Log in the same place. If the timestamps in this file are in ms my Kernel starts in 55 ms and then hangs on Networking(!!!). I'm afraid that WSL Kernel network driver lshw -c network *-network description: Ethernet interface physical id: 1 logical name: eth0 serial: 00:15:5d:52:c5:c0 size: 10Gbit/s capabilities: ethernet physical configuration: autonegotiation=off broadcast=yes driver=hv_netvsc driverversion=5.10.16.3-microsoft-standard-WS duplex=full firmware=N/A ip=172.20.186.108 link=yes multicast=yes speed=10Gbit/s is not so fast how it is expected to be

Pavel Sosin
  • 111
  • 1
  • 3