I have this PC configuration, which should have quite normal performance compared to common laptops:
ASUS TUF GAMING A15
AMD Ryzen 7 4800H
16GB RAM on 3200 MHz
SSD
64b Windows 10
First, I setup WSL2 and it was rather slow and I realized that the OpenSuse over WSL was probably swapping, because the processor has a lot of cores, but the 16GB was not enough for it.
So basically I open .wslconfig
and set processors=2
and swap=0
, it greatly improved performance of the WSL, probably stopped swapping.
- Was it a good idea?
So I was using the WSL quite happily, but after some time, I needed to install VMware for testing some functionality and it worked until the first reboot of the virtual machine and after that I realized that I can't use both WSL and VMware on 1 system, because the VMware wanted me to disable some option on Windows that was needed by WSL. (I think it was something with virtualization)
But after using the VMware I used the WSL again and realized that it's way slower. I checked the changes from the git, I rebuilt everything, I reverted to versions as before, but it was still way slower than before. I needed to start using docker container at that time (because of different reason), it was running quite fast at first so I did not pay much attention. But then I realized that some operations run very slowly and I did not know, why. Then I realized it must have been that VMware, so I uninstalled it and the WSL got faster, only the WSL, but the slowness in docker container remained.
When I check a Task Manager, CPU and Disk seem totally fine and Memory seems fine as well. So I guess the docker container is probably not using all available resources? The task runs 30 minutes instead of running 10 seconds which runs on similar PC directly, without docker container, it's huge difference...
Before running task in docker container:
While running task in docker container:
- How to set VSCode to make the docker container use much more resources and run the task almost as fast as without running it in a docker container?
I realized it's maybe related toDisabling Real-time protection only removed its 5% CPU usage, but did not make the container task any faster.Antimalware Service Executable
process, which takes around 5% CPU when running the task and usesMicrosoft Defender Antivirus Service
service. Can it be the problem? If so, how to add exception for the docker container or VSCode which runs it, in the least intrusive way?
I called docker stats
and it's really not using almost any resources at all, see:
Check also if the cores are fully used.
Issues like microsoft/WSL #6923 "WSL2 does not regconize 72c/144t (4 sockets server) only 64c" illustrate the fact that not all cores are always used on WSL2.
See the 2020 issue 5423: "WSL 2 uses half the number of cores on AMD Threadripper 3990X"
It references xieyubo/WSL2, which is about using more than 64 cores.
It is not matching your use-case with your 2020 8-cores AMD Ryzen 7 4800H), but their instruction (about changing the hypervisor scheduler type) could still have a beneficial impact.