Hacker News new | ask | show | jobs
by IronWolve 2627 days ago
Is WSL multithreaded? I love the ease of use that WSL gives, but it seems slow to cygwin on disk access. I think this is planned in a future fox by making the WSL directory to the disk instead of in a container file. I went back to cygwin for faster speed of scripts processing files.
2 comments

I noticed file IO was slow too. My solution is to do most of my work in headless Linux VMs, using WSL as the interface to manage and connect to those VMs. This way I get the bash shell and ssh client I love but get isolated environments for my projects/clients. I run samba on the Linux VMs, with mapped drives on the Windows host so that I can edit files using VS Code. Outwardly it might look a little convoluted but I get isolation, performance, convinience and an ultra smooth host OS experience.

I say this coming from around a decade of running Linux or MacOS on the desktop. This just works.

What do you use as your VM software? I take it VMWare has a pretty decent IO performance to host's files through HGFS when VirtualBox isn't as performing.
I'm actually using Virtualbox. In my case, the guest doesn't see the host's files - it's the other way around. 80% of the file operations happen within the VM, with the rest being in VS Code on the host (via a mapped drive pointing to the a samba share on the guest). This lets me preserve file permissions and allows me to backup or migrate my entire project by just copying the VM disk images. It also gives me all the performance I need (and with a ton of ram, my database workload rarely hits the disk, which is a fast nvme ssd anyway).

I'm not running a Windows Insider build, and the current version of WSL doesn't accurately represent the posix permissions on files seen via the /mnt/c mount (DrvFs). The next version resolves this by storing posix permissions and other meta data. In my case, being unable to manipulate the permissions causes us some problems. It makes a lot of sense to work on the files within the VM, in a native ext4 volume.

It's only slow at file IO, yeah.
File IO can be vastly improved by excluding the WSL OS directory from Windows Defender real-time protection. Here's a gist that has powershell and GUI instructions for accomplishing this: https://gist.github.com/noelbundick/9c804a710eb76e1d6a234b14...
This is possible but not recommended unless you are very cautious.

Windows Defender protects from Windows malware entering via WSL and Linux malware as well.

For example Windows Defender has caught comprimised npm modules inside WSL.

That is really interesting to hear! I am quite cautious about what I do in any environment, of course. How would you say WSL without windows defender compares (security-wise) with say, running equivalent operations with homebrew or macports in OS X? Or just in vanilla bare-metal linux?
There aren’t that many malware that are worse than antivirus.

What I don’t understand is why antivirus has to second guess the user.