Moving from WSL 2, back to Hyper-V VMs
I gave WSL 2 a go in 2020 and initially thought it was great, but soon started to notice some issues. Some package installs just didn't play well, for example MongoDB, and the lack of a traditional initd/systemd means you have to make changes to existing install processes and online tutorials. I found I was wasting too much time on the SysAdmin work instead of coding so I've moved back to Hyper-V VMs.
Here's my quick take on pros and cons of both systems.
CPU Usage - WSL 2 / Hyper-V VM - I've found similar utilisation across platforms, I'd recommend fast multiple core CPUs (Intel i5, i7 or Ryzen 5, 7), especially if you want to run multiple Linux systems at once.
RAM Usage - WSL 2 / Hyper-V VM - Both have similar memory requirements. You can run one Linux install on Win 10 with 8GB RAM, but I'd recommend 16GB.
Disk Space - WSL 2 / Hyper-V VM - While both take up similar disk space initially, I think WSL 2's custom kernal is shared across multiple Linux installs, where each VM you run is isolated and a full install.
Boot Speed - WSL 2 / Hyper-V VM - WSL 2 boot speeds beat Hyper-V VM, but both boot in under a minute.
Windows File Access - WSL 2 / Hyper-V VM - WSL 2's special \\wsl$
folder access is quicker than a traditional Samba share, but I haven't come across any file access speed issues with either.
VS Code Compatibility - WSL 2 / Hyper-V VM - VS Code has an embedded WSL 2 connection type and you can type code .
in a terminal to automatically open the current folder. Hyper-V VM projects can connect to VS Code via an SSH connection.
Linux Compatibility - WSL 2 / Hyper-V VM - Hyper-V VM is the clear winner here. The Linux you install is near identical to one you install on bare metal or spin up on a cloud service. While WSL 2 wins most of the other benchmarks, this one is the most important in my opinion.
Here's my guide for installing Ubuntu 20.04 on Windows 10 Hyper-V.