Reason for this short post
VMWare makes it clear in their own documentation that significant performance degradation is an expected symptom of the AMD-V/VT-x feature not being accesible.
This happens when Hyper-V is enabled. The Windows hypervisor platform takes ownership of AMD-V/VT-x, no longer allowing VMWare's hypervisor to make use of it directly.
I use VMWare virtual machines on the daily for my work, and this concern has kept me from using WSL features on my host machine in order to ensure the best performance and not suffer this "significant" loss. However, I never really checked. Today I decided to give it a try.
Testing
I enabled WSL on my host machine with the recommended command wsl --install. This installs the WSL2 base and enables the required OS level features, including Hyper-V.
Before and after, I ran the following commands as a type of benchmark in my "main" virtualized machine:
for i in {1..3}; do
sysbench cpu --threads=$(nproc) --cpu-max-prime=20000 --time=60 run | grep -E 'events per second|total number of events'
done
openssl speed -seconds 30 sha256
These will run two different types of benchmarks, sysbench, and a openssl test that hashes SHA256 as many times as possible during a 30 second period, at increasing block sizes.
As for the environment: The host machine is running Windows 11 Pro. It has 32GB of RAM and an AMD Ryzen 5 5600G CPU. The virtual machine is running Linux Mint, 12 GB of RAM, and 8 vcores.
Both before and after, neither system had any significant background task running, and both environments were given a few minutes after boot to "settle down". Also, DEP is enabled in the host.
Results
Before:
events per second: 11687.38
total number of events: 701259
events per second: 11693.65
total number of events: 701634
events per second: 11718.41
total number of events: 703117
Doing sha256 for 30s on 16 size blocks: 262900172 sha256's in 29.97s
Doing sha256 for 30s on 64 size blocks: 203912264 sha256's in 29.98s
Doing sha256 for 30s on 256 size blocks: 124544048 sha256's in 29.98s
Doing sha256 for 30s on 1024 size blocks: 49126125 sha256's in 29.98s
Doing sha256 for 30s on 8192 size blocks: 7329452 sha256's in 29.98s
Doing sha256 for 30s on 16384 size blocks: 3744126 sha256's in 29.97s
After:
events per second: 11336.14
total number of events: 680184
events per second: 11353.43
total number of events: 681220
events per second: 11173.11
total number of events: 670403
Doing sha256 for 30s on 16 size blocks: 250262872 sha256's in 29.99s
Doing sha256 for 30s on 64 size blocks: 194143236 sha256's in 29.98s
Doing sha256 for 30s on 256 size blocks: 118986631 sha256's in 29.99s
Doing sha256 for 30s on 1024 size blocks: 46796775 sha256's in 29.99s
Doing sha256 for 30s on 8192 size blocks: 7024954 sha256's in 29.99s
Doing sha256 for 30s on 16384 size blocks: 3560810 sha256's in 29.99s
Conclusion
For sysbench, there was a decrease of 3.5%. For openssl speed, there was a decrease of ~5% across all block sizes, with 8kb being the closest to an outlier with just 4.2% of decrease.
This is far less than "significant" for me, and I only wish I had bothered to attempt this before, as the advantages of having WSL in the host can be pretty nice. For example, being able to use Docker in my host OS.
The point of sharing these results is to prevent someone else making the same mistake of not using HyperV at the host on the assumption that VM performance would be hurt much.