11 ms·
In WSL1, running "wsl git status" on a moderately sized repo on an NTFS (Windows side) drive or SMB file share is nearly instantaneous. In WSL2, running the sa
by AaronFriel 7y ago
In WSL1, running "wsl git status" on a moderately sized repo on an NTFS (Windows side) drive or SMB file share is nearly instantaneous.
In WSL2, running the same command takes over 30 seconds. WSL2 is a massive hit to the seemless experience between the two operating systems with filesystem performance from Linux to Windows files orders of magnitude worse. Yes, unzipping tarballs or manipulating and stat syscalls are cheaper now on the Linux side. The downside performance loss is, however, staggering for the files I had in C:\
Don't even get me started on how long an npm install took.
One of the truly wonderous things about WSL1 was the ability to do something like this in a PowerShell window:
C:\some-code-dir\> wsl grep -R "something" | Some-PowerShell | ForEach-Item { }
Now performance across the OS boundary is so bad, I wouldn't even think of using "wsl grep" in my C drive. Or "wsl npm install" or "wsl npm run test" or any of that.
It's very depressing because WSL1 is so, so promising and is so close to feature parity. WSL2 should definitely stick around and has use cases, for Docker it's unparalleled. But for daily driver mixed OS use, WSL2 has made me very unhappy. I think I'll be deconverting my various WSL distributions because the performance hit was too much, it just was absolutely unbearable to even run simple commands in my Windows side.
- michaelgrafl 7y agoDeactivating Windows Defender for the subsystem‘s storage folder helps somewhat, but I agree that the situation makes the WSL close to broken for many potential users.
- veesahni 7y agoI believe WSL2 was designed to keep your files inside on ext4 instead of outside on NTFS.
- Dylan16807 7y agoYes, but it sure would be nice to get native speeds on both.
- veesahni 7y agoThere in lies the challenge that they have to deal with. WSL1 was not great in local or cross-os i/o. WSL2 is at least great in local i/o.
- skrebbel 7y agoBut what's the point of that? If I wanted my files to be on Linux I'd use Linux. I'm on Windows exactly because of things like this: the ability to use proper UI tools like Explorer to manage my files. How do I do that with WSL2?
- ccmcarey 7y agoGo to \\wsl$\ and it mounts the WSL instances as network drives.
- skrebbel 7y agoSo the idea is that you put all your work in that network drive and then open it across the network from your IDEs and Explorer etc? I mean, not hating it, but that doesn't feel all too straightforward, definitely less sonthab wsl1 :/
- TotempaaltJ 7y agoI think you can mount to a drive letter as well.
- WorldMaker 7y agoIt's not a network path, it's a pseudo-device. Windows uses the \\ UNC file paths for a lot more things under the hood than just network access. There's a bunch of rare device file paths that you'll get UNC paths for, and every folder path canonicalizes to at least one UNC path for multiple reasons. Though it is powering that pseudo-device by a 9p-based file server under the hood, it's not a network accessible path, it's only available to the local system. The trade-off between WSL1 and WSL2 (and you can have both on the same system and migrate distros both directions between the two) is mostly how often and where do you expect to need to deal with the 9p file server between your operations. In both versions Windows needs to use the 9p server to access Linux files, in WSL2 Linux also needs the 9p server to access Windows files.
- JetSpiegel 7y ago
- dleslie 7y agoMy git status/add/commit/push cycle has gone from seconds to minutes in length. It's unbearable and I'm going to abandon wsl as a result. Shame, it was really good.
- AaronFriel 7y agoYou can convert WSL2 to WSL1! There's an argument to wsl.exe you can use to go back. Do it, free yourself (and your kernel)
- dleslie 7y agoWill do! Thank-you.
- squaresmile 7y agoI feel like they don't advertise this enough. I was under the impression that it's a one way street from wsl1 to wsl2. Since wsl2 is not strictly better than wsl1, it's nice to be able to convert and pick the trade-offs you want.
- WorldMaker 7y agoYeah, the mistake of using numbers instead of names gives the impression that 2 is strictly better than 1 and that migrations are unidirectional upgrades. Even just letters like WSL-A and WSL-B might have given a better impression.
- Zekio 7y agowhy not use git natively? I've never understood why people use git in WSL since the IO performance isn't great
- dleslie 7y agoI use Emacs in WSL, along with a suite of other tools like rust-analyzer, and the experience is _lightyears_ beyond trying to run those tools under regular Windows.
- ahupp 7y ago> and is so close to feature parity That was not my experience with WSL1; I was regularly running into unimplemented features. Some examples: the Z3 solver used clock_gettime for timeouts, and their specific usage was broken in WSL1 so you'd get random failures depending on how long the solve took. And don't get me started on running Chromium. It felt like WSL1 would be running into the long tail of compatibility issues for years. But I'll admit that I don't try to use it the way you do, I run WSL precisely so I'll never have to launch cmd.exe.
- close04 7y agoSome useful network related stuff wasn't implemented either in WSL1 (NETLINK_ROUTE\RTM_GETROUTE, AF_PACKET family). This meant even good ol' nmap was out.
- TecoAndJix 7y agoThe lack of network stuff killed it for me
- g_langenderfer 7y agoI switched from Linux to wsl for a while. I'm back to Ubuntu after unexplained blue screens. Ubuntu running fine.
- sz4kerto 7y agoWSL2 is really not designed for using Linux tools on your NTFS-based filesystem. Store everything on the WSL filesystem, that works perfectly. If you need GUI tools try VcXsrv.
- sieabahlpark 7y agoWhat do you propose if you want to use a windows program to edit those files? For example I use intellij on Windows but want to compile and test on the Linux machine. If it takes 30 seconds longer than wsl 1, why would I bother changing? What is the actual point of wsl if not for the cross compatible filesystems
- wutwutwutwut 7y agoYou can access files on the Linux file system from Windows.
- sieabahlpark 7y agoHas that changed from wsl 1? I've seen bad things about directly trying to modify the files within wsl. It's not the appdata folder right?
- cosmie 7y agoMicrosoft is even integrating seamless access shortcuts to the WSL filesystems as top level citizens within File Explorer[1]. https://www.theverge.com/2020/4/8/21213783/microsoft-windows-10-linux-file-explorer-integration-features https://www.theverge.com/2020/4/8/21213783/microsoft-windows...
- deleted 7y ago[deleted]
- noisem4ker 7y agoSince version 1903, the proper way to access Linux files for writing is to invoke explorer.exe from within WSL. A transparent 9P mount is created for the working directory and files are made accessible through a regular Explorer window. https://devblogs.microsoft.com/commandline/whats-new-for-wsl-in-windows-10-version-1903/ https://devblogs.microsoft.com/commandline/whats-new-for-wsl...
- reiyi 7y agoI found the filesystem performance on WSL1 abysmal, way slower than running same things in virtualbox
- pjc50 7y agoClearly the best solution is for Microsoft to (a) write a proper ext4 driver for Windows and (b) find some way of embedding SIDs into ext4, then you could just format the drive as ext4, boot off it, and have the improved performance. (This is mostly a joke, but the performance of NTFS for certain operations has always been abysmal, and having a virus scanner injecting itself into all the operations only makes it worse.)
- sabas_ge 7y agoWell, native access to my Ubuntu partition from Windows would be welcome.
- m463 7y ago> Clearly the best solution is for Microsoft I wonder about the bigger part of this question. What are the higher-ups saying? I wonder if this is like the IBM PC, which was a GOOD THING invented by a sort of an offshoot of IBM culture. Then IBM higher-ups stepped in and tried to control the platform (PS/2, OS/2, microchannel, etc) WSL is attracting people to windows. But the endgame isn't to lose them to linux. So they have to tie it into windows more. But if they make it too slow and bloated they might lose. an interesting situation.
- majewsky 7y agoAFAIK the main problem is that Unix's file permissions do not cover Windows' permission model. That would be tolerable on a data partition, but a system partition is going to use all kinds of very particular permission setups on system binaries etc. You might be able to model that stuff as xattr, but then it could be problematic to mount that ext4 partition into Linux because applications might be copying files without respecting the xattrs.
- XzAeRosho 7y ago>AFAIK the main problem is that Unix's file permissions do not cover Windows' permission model. Well, since Microsoft has been borrowing more and more ideas from the Linux ecosystem, it would not surprise me that a Windows 10 successor would include some kind of compatibility layers for different file systems. We can dream...
- saurik 7y agoHave you tried using cygwin? I found cygwin worlds better than WSL, as it always worked correctly on arbitrary disks and folders.
- barrkel 7y agoI too have found this, with one exception: fork/exec is appallingly slow. This means ad-hoc scripts in Cygwin should be written as much as possible as pipelines and not loops; bash string functions should be used over sed, grep etc. whenever you can help it. But with that caveat in mind, Cygwin turns Windows into an acceptable Unix for command-line purposes. I don't think it's quite as good as a development environment when you're targeting Linux though. That's where WSL (in either form) makes a lot more sense.
- the8472 7y agoIf microsoft implemented the host side of virtio-fs then the guest could make use of that. Also, IO performance of WSL1 wasn't exactly great either compared to native linux filesystems.
- stragies 7y agoHere's an excellent post by SvenGroot from MS with lots of background-info: https://github.com/microsoft/WSL/issues/4197#issuecomment-604592340 https://github.com/microsoft/WSL/issues/4197#issuecomment-60...
- __tg__ 7y agoThe most useful bits are always buried deep down in the threads. Thanks for posting this.
- wahern 7y agoApparently[1] virtio-fs wasn't mainlined in Linux until 5.4, which was rolled last November. I thought it had been mainlined years ago. That helps to explain why support is lacking everywhere. [1] https://kernelnewbies.org/Linux_5.4 https://kernelnewbies.org/Linux_5.4
- MisterTea 7y agoI don't blame MS for giving up. Think about how complex it is to maintain a custom version of the Linux kernel which isn't a kernel but a wrapper for your very foreign OS. I'm surprised they even went that route. My guess is they people who put it together were under the assumption that Linux should be as simple as to implement as the old Windows Subsystem for Unix and POSIX API.
- mattbee 7y agoMy understanding was that there were some hard-to-impossible problems to solve to really accelerate the filesystem access from the Linux side under WSL1. That meant that people doing disk-intensive workloads on the Linux side noticed a big slowdown compared to a native Linux system - certainly e.g. running a big test suite, or a git checkout felt really incredibly slow. The switch to a VM flipped this relationship round - so now the formerly native / NTFS side is the second-class citizen, but you get the expected performance when putting your files on the "Linux side". For me (doing fs-intensive Rails development), this was a big win. WSL2 will also quite happily gobble so much memory that Windows slows to a crawl (especially filling Linux's disk buffers on file copies) - that seemed like an odd default, - you just have to pop a .wslconfig in to restrict its usage. I agree with the other posters here that the WSL1 approach seemed far more elegant, and probably the only way to "not see the joins"- with WSL2 we're worrying about filesystem boundaries _and_ memory now, probably forever. So I hope someone still working that nice seamless syscall layer for a future WSL3.
- littlestymaar 7y agoLong bet: WSL3 will just be Microsoft dropping the NT kernel altogether and replace it with the opposite compatibility layer (like Wine) running on top of the Linux kernel. It probably won't happen anytime soon, but to me it looks pretty inevitable in the long run : because of Azure they already spend tons of engineering time on the Linux kernel nowadays, and maintaining their own proprietary kernel won't make much economic sense for long, exactly like maintaining their own browser engine.
- WhyNotHugo 7y agoI'd be very happy to see that happen one day. I've a really hard time grasping anything windows, and the more *nix it becomes, the better! <3
- ddevault 7y agoTip: you get great performance by just installing and running Linux directly.
- olyjohn 7y agoYeah I really don't get the desire to do unixey development on Windows. Boot up a VM and SSH into it, if you really must have Windows. It's not like you have to buy a license to use Linux. I keep struggling to understand what WSL brings to Windows. First it was a totally incomplete distro, and now it's just a fucking VM. Seems like a gimmick more than anything. Virtualbox, HyperV, etc will all allow you to access your Windows files on the guest OS. If that doesn't work, just set up an SMB share and map it. Why all the complication? Does clicking one button to install a distro really serve anybody? Why do you want to use the fucking awful Windows Update mechanism to update your kernel? Updating the kernel in Linux is so fast and easy... You learn so much more about Linux by running Linux. Why are we trying to abstract that away? I think it's Microsoft's desperation to keep devs from continuing to jump to MacOS and Linux.
- alkhayat 7y agoThis ^
- eloff 7y agoSo if accessing ntfs from wsl is now slow, you can put the files in wsl instead. The problem then, if you're using this as a dev machine, is how do you edit them in Windows? I want to use my JetBrains IDEs to edit wsl files, if that doesn't work I'd just stick with dual boot.
- hiram112 7y agoThis was the use case I was really hoping for, also. I've been back and forth with various employers over the years, depending on their requirements - Windows only (it works for Java), Cygwin, VMware Workstation with Linux VMs, MacBook, Linux on the hardware, etc. WSL1 was unusable as there was no way to run IntelliJ or Eclipse on Windows, and have it work on large projects sitting in the WSL filesystem - the file IO was way too slow, and the instantaneous feedback you expect from Jetbrains products just wouldn't work. VMs on Windows would work, but again only if you were developing 100% in the Linux VM, IDE included, and just used Windows for Office and whatever else was required. But at that point, you still had to deal with all the Linux issues like ugly fonts and broken plugins, with all the problems of slow VM file IO. Cygwin also similar to WSL1 - just wouldn't work for anything that required real Linux underneath. Linux direct on the laptop works, but with all the same problems that have been around for 20 years and never seem to get fixed - broken multi-monitors, ACPI issues, driver support for Nvidia, video conferencing being too slow or unsupported, no MS Office, etc. I just don't have the time or motivation to spend hours every week babysitting a Linux laptop. Macbooks are definitely the way to go, I'm just worried that my employer will balk at the cost of the new $3K 16" MBPs next upgrade cycle.