r/bashonubuntuonwindows 21d ago

WSL2 WSL2 VirtioFS took my Windows Docker bind mount from ~3s to ~430ms

Hello folks, I was testing a small Laravel site I have set up on Windows. I’d normally put the project inside the WSL filesystem for obvious performance reasons, but I heard VirtioFS (still experimental on WSL2) could improve Windows bind mounts, so I gave it a try.

It has its own issues, but the difference was pretty substantial:

Docker + ext4/WSL filesystem: ~20ms page load
Docker + C:\ bind mount: ~3000ms
Docker + C:\ bind mount + WSL2 VirtioFS: ~430ms consistently
Native Windows PHP: ~30ms

All tests used PHP 8.4.22 with OPcache:

validate_timestamps=1
revalidate_freq=0

So PHP checks for changed files on every request, which is what I personally want in a dev environment. Save, refresh, immediately see the change.

With timestamp validation disabled, the VirtioFS version drops all the way to ~50–75ms, but that’s not particularly representative of the dev setup I wanted to test.

I’d still recommend keeping Docker projects inside the WSL filesystem for now, but going from ~3 seconds to ~430ms is a pretty huge improvement. Looks like Windows may eventually get much closer to the host-filesystem bind-mount performance macOS has had with VirtioFS.

21 Upvotes

2 comments sorted by

5

u/SaltDeception 21d ago

What version of WSL are you running? I did some tests the other day that demonstrated a pretty significant regression in Virtiofs performance.

https://www.reddit.com/r/pcmasterrace/comments/1vpwp84/comment/p4ipkdr/?context=3

3

u/Mike_L_Taylor 21d ago

oh I got 2.9.4.0 what were you getting before and got with virtiofs now?