6 ms·
WSL 2 is getting faster Windows file system access
- themeiguoren 4mo agoI can’t find any benchmarks on this, anyone have a sense of the speedup that can be expected here? And for what it’s worth, that version isn’t available yet when I try to update WSL.
- deleted 4mo ago[deleted]
- tonymet 4mo agoa test compile of hugo (moderate go app) on a AMD Ryzen 7 7735HS with SSD WSL filesystem = 50s virtiofs = 75s it seems a lot faster. I don't use drvfs (windows files) usually. 50% performance gap is good. And MS Defender kicked in beforehand losing about 10 seconds. with some config you could turn off defender and get this down to 60s
- cheema33 4mo ago> WSL filesystem = 50s > virtiofs = 75s > 50% performance gap is good. I am somewhat confused by this. How much time did the default DrvFs take? Or did you mean DrvFs when wrote virtiofs?
- tonymet 4mo agoDevfs = virtiofs(for this test ) . Drvfs is the param given to mount , which chooses virtiofs or 9p (plan9/ /slow) The results above are wsl vhd vs virtiofs, the new file system for accessing windows files . Plan9 /9p is the old one , not tested .
- tonymet 4mo agoI didn’t test plan9 because I don’t use it
- tonymet 4mo agowsl version 2.7.7 seemed to work with the listed config + reboot
- tonymet 4mo agomore or less this is what I ran to benchmark https://gist.github.com/tonymet/ec7fc4af0eb11c9d5af22c76d05686e2 https://gist.github.com/tonymet/ec7fc4af0eb11c9d5af22c76d056...
- avadodin 4mo agoIf it is as good of an improvement as the first major update, it will be hard to tell from native. Hopefully, they will just push it out to everyone asap. We make heavy use of symlinks into Windows drives.
- chris_money202 4mo agoThey are undoubtly doing this because so many users operate out of /mnt/c with zero clue of that implication.
- alberth 4mo agoWould you mind elaborating (for those of us uninformed)
- yakz 4mo agoIt's difficult to overstate how horrible the performance is.
- weird-eye-issue 4mo agoOne example is that if you have a node modules folder on Windows and you try to delete it from WSL it can take 10 plus minutes whereas if you deleted it directly in Windows it would have just taken a few seconds Also if you try running Next js from files on Windows from WSL it takes minutes for each page to compile to the point that any local development is impossible so you would have to either run the Next JS server on Windows or move the files to WSL
- rahkiin 4mo agoAnything with node_modules takes ages on my Windows machine, whether it is through WSL, Docker or direct, largely in part due to corporate filters, checks, anti-virus and malware protectors and endpoint control.
- DanielHB 4mo agoAlthough the stuff you mention is true, it is not the only reason. NTFS is just notoriously bad at reading/writing tons of small files. It also has a lot of problems with locking files that are open by a process, if you have a rogue process reading your node_modules npm install or rm node_modules can hang until that process finishes. yarn2 keeps dependencies as tarballs instead of extracting them to disk, imported files get loaded from the tarball at runtime. Makes a massive difference in windows.
- thesis 4mo agoMoved to mac about 7 years ago because of horrible WSL file system speed was.
- nozzlegear 4mo agoSame here, though I went to Linux first for several years. WSL file speeds, especially when running npm install, were the impetus that ultimately got me to switch off of Windows.
- weird-eye-issue 4mo agoSounds like you were just doing it wrong Either you run npm install from Windows if you are operating on the Windows file system or you run it on WSL if you are operating on the WSL file system both cases will be very fast
- hparadiz 4mo agoThe entire Windows operating system is doing it wrong. Seriously who daily drives windows these days. lol.
- weird-eye-issue 4mo agoWell before Windows I spent years with both Linux and Mac and I found Windows to be a good mix of stability and suitability for development now that WSL is a thing. Also for gaming it's the best by a long shot so just all around I've found it to be best and WSL made me never miss Linux.
- hparadiz 4mo agoNah my frames on Linux beat yours easily.
- weird-eye-issue 4mo ago
- phowat 4mo agoTangentially , I was a heavy used of wsl and moved to linux a few months ago and LLMs made most of the downsides of using linux as a desktop go away for me. I chatted with claude about the migration to find the best distro, decided on Fedora. After the install I asked everything I wanted to configured and got straight answers. In 3 or 4 hours I had an even more comfortable experience than I had on windows. AI made the annoying parts of trying to figure out how to edit all the config files to have linux behave the way you want very easy. I also had claude code write a bunch of scripts that I could have done but would probably never bring myself to actually do it . WHen you have a coding agent readily available , having an open source desktop environment makes a lot more sense. I encourage everyone to try it.
- hgoel 4mo agoI did this too, made switching my desktop to Linux so much smoother. I have a Windows laptop for my Windows needs and most of my gaming is fine on the Steam Deck, so I realized I didn't need to always boot into Windows only to use WSL.
- ragequittah 4mo agoI also did this as well as learned pfSense then OPNSense when pfSense went bad. Also made a pretty complicated XCP-ng setup. Learned all this with the ancient ChatGPT 3.5-4.0 models. I can hear a subset of people cringe saying "but LLMs are BS machines and you aren't learning anything!" I heartily disagree on both fronts. The main thing holding users like me back from linux was always the snarky RTFM community and the fact that everything has 25 different answers (depending on distro, window manager, and many other factors). LLMs take care of all this friction for you very nicely.
- CamperBob2 4mo agoThis. It is hard to exaggerate how easy Claude Code (or, I'm sure, any number of other harnesses of choice) makes it to migrate to a new operating system. It is truly a Star Trek-level experience. Nobody who doesn't want to run Windows (and who isn't forced to run it) needs to run Windows anymore.
- markstock 4mo ago
- avaer 4mo agoProton, Copilot, and literally this single issue are what pushed people to Linux. If I were in charge there would be a team devoted to fixing this a decade ago. WSL singlehandedly stemmed much of tide of developers moving away from Windows, but WSL native filesystem performance gave devs that magical experience when they boot into Linux the first time and see that the filesystem doesn't have to be ass. There's always been hacks around this, but for many devs the easiest hack was to ditch Windows. They should have moved heaven to fix this on day one, there's really no engineering excuse. Linux is open source.
- Kenji 4mo ago[dead]
- evanjrowley 4mo agoPerhaps you meant Pluton and not Proton? https://news.ycombinator.com/item?id=25191319 https://news.ycombinator.com/item?id=25191319
- oofbaroomf 4mo agoProton is a tool Valve made, based on Wine, to easily run Windows games, on Linux [0]. GP meant Proton. [0]: https://github.com/valvesoftware/proton https://github.com/valvesoftware/proton
- evanjrowley 4mo agoSorry, I thought you were enumerating gerivances against Microsoft and not better alternatives. Pluton has been controversial because it's been marketed as a "security" solution when in reality is's just doing DRM. Originally greated for the Xbox, it's kind of the antithesis of Valve's Proton.
- deleted 4mo ago[deleted]
- skissane 4mo ago> Proton, Copilot, and literally this single issue are what pushed people to Linux. This isn't the only issue. I think another big issue is pushing more and more integration with Microsoft cloud services (e.g. Microsoft accounts), advertising, etc, which Microsoft has made increasingly difficult to opt-out of. They could fix every single technical limitation anyone has ever complained about, but if they don't change their corporate culture on forced cloud/advertising/etc, many won't care about those fixes.
- mattkevan 4mo agoWhere are we on the embrace/extend/extinguish curve right about now?
- protocolture 4mo agoMicrosoft is almost done extinguishing Windows.
- zaptheimpaler 4mo agoI was trying WSL years ago and this is one of the reasons I just moved to a full linux server instead. We still have way too many problems interfacing across filesystems. I hope with AI we will see an iteration on ExFAT that has all the journalling, versioning etc. magic of modern FS' and can be adopted across all 3 OSes. Probably a long shot but I can dream :)
- phendrenad2 4mo agoHopefully they're heading towards a "boot to Linux" mode.
- bitwize 4mo agoAre you sure you want to: ( ) Shut down the computer? ( ) Restart the computer? (*) Restart the computer in Linux mode? ( ) Close all programs and log on as a different user?
- charcircuit 4mo agoNow that virtualization exists you don't need to restart to use another OS.
- sanp 4mo agoHasn’t this always been the case? I have always run builds under WSL2 in Windows because of this.
- tonymet 4mo agowhen you mount "drvfs" (the automounting feature, or you can call mount -t drvfs) , it's usually plan9, which is like NFS. with the new wsl version, kernel and config from that blog, it will mount virtiofs, or warn you
- tonymet 4mo agocounterpoint: WSL is great. I like it. I enjoy & prefer Windows desktop & Linux terminal. very happy.
- kenz0r 4mo agoWhat killed WSL for me was the incredibly janky way I had to share USB peripherals. usb-ipd works 80% of the time, all the time.
- ryanshrott 4mo ago80% is being generous. I gave up on USB for WSL altogether and just pass the whole controller through with Hyper-V. On laptops, though, that is not always possible.
- agentultra 4mo agoDo the audio buffers to the host device next!
- cmovq 4mo agoI had no idea they used the Plan 9 file server for accessing files in WSL. I wonder what the original reasoning for choosing 9P was.
- bitwize 4mo ago9P is in the kernel and provides a simple, fast networked VFS without many of the drawbacks of NFS. In particular, 9P-over-virtio is already used in Linux virtualization environments to expose parts of the host file systems to the guest. Since this solution was widely adopted and lying around, Microsoft's WSL2 solution also used 9P-over-virtio to expose the Windows file system to the guest Linux.
- asveikau 4mo agoI was always disappointed with the design of wsl2. The wsl1 design of a syscall layer atop NT had greater architectural purity. They way I heard it, they introduced a virtual machine into the design specifically in order to bypass poor NT filesystem performance. I'm sure it's easier said than done, but it would have been nice if they instead fixed the issues on the NT side, rather than side step them with a VM.
- josh3736 4mo agoMy (possibly uninformed) understanding at the time was that it was Docker, not solely filesystem performance. WSL1's file performance is pretty much as good as it gets on Windows, since open(2), read(2), etc are all translated directly in-kernel from Linux to Windows API calls. It's still slower than a real Linux kernel since Windows' filesystem filter drivers add a lot of overhead to every operation, and Windows Defender and its realtime scanning in particular makes it 10x worse. (NTFS itself is fine.) WSL1's filesystem situation is now "fixed" by Dev Drive, which is just a new partition with most filters disabled and Defender is put in to a different mode where scanning is asynchronous instead of blocking every open(2). WSL2's mounts of Windows disks still has to deal with all of the above, plus the overhead of serializing every operation over a VM socket, which is largely fixed by what this article describes. So even if you've enabled virtiofs to speed up WSL2's cross-VM transfers, you're still going to hit the same Windows filesystem caveats that apply to WSL1 and native Windows apps. On the other hand, the WSL2 in-VM ext filesystem (ie, the / mount) will be the fastest to Linux apps since it never touches the Windows side, but accessing those files from Windows sucks since they're buried in a VHD image, accessed over a slow 9p (I think) network-like mount on \\wsl.localhost\distro\ All of that to say filesystem perf may or may not have been a factor in the switch from WSL1's very cool NT persona architecture to WSL2's decidedly more boring VM design, but it was pretty clear that Docker was the real showstopper. Devs needed to run containers, and WSL1 couldn't (and still can't) do it. I imagine Microsoft took a look at what it would take to implement container support in the NT kernel to the point that Docker would work, and decided it was simply too much work when they could just slap a VM in and get the entire Linux kernel API surface for free. So thus we got WSL2. I still use WSL1 for light work like running ssh, since there's basically no overhead at all (5 MB of RAM total to run ssh), compared to needing to run an entire second OS in WSL2. And as long as you don't need any containers, even heavier work runs nicely on WSL1 since there's no VM overhead or network NAT shenanigans. But if you need containers, you need WSL2.
- anamax 4mo agoI switched from WSL (reconn'd to WSL1) to WSL2 because I thought that WSL1 would be abandoned. However, the shell for WSL2 runs in a window that grabs things, such as ^V. So, ssh from WSL2 (to AWS for example) is awkward. For exampl, Emacs on the AWS box is almost unusable.
- foepys 4mo agoAre you using the Windows Terminal app? CMD or Powershell are yanky but Windows Terminal solved a few icks for me. https://github.com/microsoft/terminal https://github.com/microsoft/terminal winget install --id Microsoft.WindowsTerminal -e
- anamax 4mo agoI'll try it. And if it works, I'll wonder why microsoft doesn't make the ubuntu button use terminal.
- psyclobe 4mo agoWSL1 was really really fast! It was quite unique system too totally customized for the Linux kernel and windows interfacing! Was really disappointed when WSL2 came along and just virtualized everything; fs performance took a shit. Anyway I don't care about windows these days, all Linux all the time.
- ernsheong 4mo agowhy don't they just switch completely to Unix, lol
- thot_experiment 4mo agoNice, FWIW this is currently pretty easy to solve by just keeping your stuff on a separate EXT4 volume and then mounting that under Windows. Windows accessing a mounted EXT4 volume through WSL is much faster than the other way around.
- thomasswilliams 4mo agoUpgraded and saw faster WSL launches straight away
- rtpg 4mo agoit's kinda shocking how both WSL2 file perf and Docker for Mac file perf are so horrendously bad that you can just tank performance and have a 3x better local dev setup on most projects by using "normal" Linux.... and yet it's been the status quo for so long. I don't get how people are so comfortable with dev tooling being as busted as it is.
- rcleveng 4mo agoDocker sucks on the mac, orbstack is great if you need docker. If you are on linux, use podman too vs. docker.
- politelemon 4mo agoNice to see a bit of good news here, WSL is an underrated component in enterprises, and quite often the only way you can get close to Linux. Windows and Macs feel like trading one cancer for another with different logos.
- deleted 4mo ago[deleted]
- jstrebel 4mo agoIt's always good to see improvements around WSL2, but especially this one is not so relevant IMHO, since it only affects WLS2 file access to Windows file system. If you store your dev environment in WSL2 anyway, this won't help you.
- rdwrrr 4mo agoGive me one good reason why anyone would bother with any of this at all?
- hiAndrewQuinn 4mo agoCan't run bare metal Linux at work, can run WSL on Windows. That's probably 80+% of use cases.
- epolanski 4mo agoAlso lack of specific software on the Linux side. Adobe suite (I used Figma and Adobe tools in my webdev career), PDF editing is a huge issue and lackluster on Linux, most of the office suite is not available natively on Linux (no, there's no valid replacements when your company is deep into VBA tooling, etc), PowerBI, but also many specific internal tools that many businesses have and have been developed as Windows-only applications, I had anything ranging from specific VPNs to screen sharing utils. But there's also more dev-focused tooling, from game development frameworks like Unreal Engine (for which I had to develop UIs in the past) and the related Visual Studio to FPGA tooling and USB debugging. The list is long and generally based on your domain, but in a career I had almost always moments where I could not avoid having a Windows machine. WSL allows you to generally have both of the words. I don't dislike Windows in general to be honest, Power Toys, WSL, a great Terminal, it's an okay machine to develop and I like it better than MacOS from which I still have nightmares for being locked out of my hardware for 2 months due to an apple account issue.
- rdwrrr 4mo agoSure that makes sense. Maybe I am just spoiled.
- pdantix 4mo agoas terrible as windows has gotten, i'm not switching my desktop to linux until it has perfect game + nvidia driver support, something that will probably never happen due to anti-cheat. until then, WSL is great.
- satvikpendem 4mo ago
- ta8903 4mo agoSick, I can stop using `pwd -P` based switching between /usr/bin/git and git.exe (and for some other stuff like ripgrep). Hell, I can probably stop using PowerShell completely.
- flumpcakes 4mo agoWSL2 is honestly the only thing keeping me sane having to work with a Windows 11 desktop environment at work. The new container capability also looks magical, and being able to access that directly from windows apps seems pretty cool too. Not sure it would be worth the time investment vs. docker desktop, but interesting none the less.
- NoGravitas 4mo agoNow if only Windows would also get faster Windows file system access.
- tonymet 4mo agoUse Windows Dev Drive. Much faster for development workloads.
- p-t 4mo agoi've never noticed slow file access through wsl, but ive also only used it to compile small c programs tbh
- xela79 4mo agoAny benchmarks and comparisons done? am I overlook it?
- tonymet 4mo agoI put one below comparing native WSL FS to virtiofs. 50s build time on native vs 75s build time on virtiofs. Virtiofs came to about 50% slower, and likely only 25% slower than native (i saw MS defender kick in, which you can disable). The older “plan9” aka “9p” is likely 10x slower. I don’t use plan9 (the current windows file system in WSL), but I would guess that same build would take 3-5m or more.
- tonymet 4mo agoIf I get enough updoots here I’ll try to do a more empirical plan9 vs virtiofs test.
- ranger_danger 4mo agoWouldn't using NTSYNC on the Linux kernel side also improve filesystem performance?
- edallme 4mo agoI wouldn't try this yet. I ran into problems with silent failing automount, e.g., https://github.com/microsoft/wsl/issues/40773 https://github.com/microsoft/wsl/issues/40773