I was trying to get a Laravel image up and running on Docker for Windows (Windows 11), and after config, it was taking several seconds to load each page (insanely slow, definitely outside Laravel benchmarks). I am using WSL2 and have native (full resources) allocated to the VM. Why is it running so slow?
I inspected resource allocation and it shouldn't be a problem (50% memory and all cores). I have a fairly beefy machine. I tried a reinstall and new Docker image and closed all competing tasks.
CodePudding user response:
TL;DR: don't host docker files on the WSL mount. Either use non-WSL docker or do an SSH deployment to the WSL local filesystem.
The issue ended up being that my project files were loaded under /mnt/c in WSL, and, for some reason, this is VERY inefficient for file access and modification. I ended up moving my files to a local folder in the VM (for me, this was my home folder) and page loads reduced to sub-second. Just the move (mv x->y) took a few minutes and my fans were going crazy.