Reputation: 1000
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.
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:
Antimalware Service Executable
process, which takes around 5% CPU when running the task and uses Microsoft 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:
Upvotes: 2
Views: 7584
Reputation: 39
/home/yourdir
in WSL2/mnt/c/yourdir
Internally converts file formats between Windows (NTFS) and Linux (extf).
Also:
Upvotes: 3
Reputation: 2070
VSCode dev containers is supposed to make this kind of setup repeatable / shareable, but on Windows I've found the performance to be unusable which all seemed to boil down to the speed delay in wsl2 mapping files to the host.
I've settled on running VSCode and docker inside a Linux VM on Windows, and have a 96% time saving in things like running up a server and watching code for changes making this setup my preferred way now.
The standardisation of devcontainer.json and being able reliably share dev setup between developers, and even to use github codespaces if you're away from your normal dev machine make this whole setup a pleasure to use.
see https://stackoverflow.com/a/72787362/183005 for detailed timing comparison and setup details
Upvotes: 1