5 ms·
I agree with the sentiment but, some scenarios have become orders of magnitude more complicated on WSL2 like connecting to a daemon on Windows or vice versa. I
by sedatk 6y ago
I agree with the sentiment but, some scenarios have become orders of magnitude more complicated on WSL2 like connecting to a daemon on Windows or vice versa. I understand clear cut security boundaries and separate network interfaces, but it's extremely hard to get them running smoothly now. Everything was on localhost on WSL1.
Memory usage has also gone bonkers with the VM approach, causing unnecessary overhead for casual users who don't need performance.
- whoisburbansky 6y agoI apologize if I'm missing something here, but if casual users don't care about performance, what's the overhead here?
- deleted 6y ago[deleted]
- neurostimulant 6y agoIIRC WSL 2 use 50% of your memory in Windows, or 8GB (whichever is smaller) by default.
- chaostheory 6y agoI have 32 GB. Hardware is cheap for Windows. imo That's one of its main perks vs Apple
- ASalazarMX 6y agoIs that an upper bound? My Ubuntu 20.04 console sessions on WSL2 consume a couple tens of Mb.
- Karunamon 6y agoLook for a 'vmmemory' entry in your process list, it'll likely be in the hundreds of megs, if not a gig or so.
- ASalazarMX 6y agoI don't have that process while running WSL2 in my machine. I have vm-agent and vm-agent-daemon, but I'm using a virtual desktop, so this might or not be related to WSL2. Both of these processes consume less than 10 Mb combined. In my other comment [0] I referenced a link from Microsoft that says RAM is dynamically allocated and reclaimed when freed. 0. https://news.ycombinator.com/item?id=25161769 https://news.ycombinator.com/item?id=25161769
- neurostimulant 6y agoThe individual process inside the vm might not consume much, but the vm itself might reserve some GBs of memory. Try looking at how much memory `vmmem` process used in task manager.
- acqq 6y agoAlso: https://www.reddit.com/r/bashonubuntuonwindows/comments/d8x7kl/copying_file_to_wsl_2_consumes_all_my_ram/ https://www.reddit.com/r/bashonubuntuonwindows/comments/d8x7... "So, I was copying a 8GB file to my Debian home folder using Windows Explorer, via $wsl network. The copy process made my CPU's fan runs like a jetplane, and it stop copying when at 95%, then I opened up Task Manager and saw this. even after it finish copying, Vmmem process still hold 13GB RAM and not release any. Why? I have to shutdown WSL after copy a big file? Answer: Very normal but annoying issue. ... The only solutions are: a) a kernel change by MS to limit the amount WSL2 can cache b) disable to caching ( nocache ) c) Put a limit on the WSL hyper-v VM Not sure what or how MS will try to solve this issue... WSL1 did not have this issue, because it shared the main system memory, because it was just a layer around the NT kernel."
- Hansi 6y agoCheck the other comments on the link? Solution c) is already there?
- ASalazarMX 6y agoI can't find that process in my system, nor a significant difference in physical RAM usage before and after starting Ubuntu in WSL2. Digging a little it seems like memory is dynamically allocated and reclaimed when freed. I'm not defending WSL2, just trying to understand how is it supposed to consume 8GB of my 16Gb of RAM. https://devblogs.microsoft.com/commandline/memory-reclaim-in-the-windows-subsystem-for-linux-2/ https://devblogs.microsoft.com/commandline/memory-reclaim-in...
- whoisburbansky 6y agoThis hasn't been my experience, but sure, even if memory consumption is higher, for most applications where Windows users are going to use WSL, additional memory is incredibly cheap compared to the dev overhead of trying to boot into a Linux environment and switching back and forth.
- B1FF_PSUVM 6y agoExample: on WSL1 I could cheaply run Linux CS labwork including valgrind checks etc. - with less resources and much snappier than with VirtualBox VMs I'm not confident about diving into WSL2.
- whoisburbansky 6y agoI've had surprisingly good results running that sort of thing under WSL2. Pure CPU workloads actually work pretty well, and in my experience valgrind has mostly been CPU intensive?
- selectodude 6y agoWSL1 hasn't gone away for those who prefer it. But we're talking about an extra gigabyte. It's still cheaper than a full VM.
- 1996 6y agoIt's even cheaper to only use what you need with msys2! bash inside mintty gives me all I need, with minimal overhead. Eventually, I'd like to see bash inside Windows Terminal made easily available - complete that with busybox, and you cover 90% of the Linux usecases without having to download anything (a bit like how starting Terminal.app offers most of what you need on MacOS) Add an option to install packages using msys2/pacman for the power users, and I believe most people would not waste time (or disk space, or ram) playing with WSL1 or WSL2 just to run the one thing they may need.
- shawnz 6y agoWhat makes you think the overhead between Cygwin/msys2 and WSL 1 would really be so great? They are both just translation layers after all.
- 1996 6y agoWSL1 tries to do too much. WSL2 tries to do even more. msys2 mostly cares about running your textmode software. For example, someone talked about processes. Here's all that I see in msys2: # ps xwau PID PPID PGID WINPID TTY UID STIME COMMAND 480 479 480 18796 pty1 197611 14:13:13 /usr/bin/bash 479 1 479 16872 ? 197611 14:13:12 /usr/bin/mintty 1118 480 1118 16496 pty1 197611 17:00:32 /usr/bin/ps Most of the time, I don't need to access Windows processes - and if I do, data can be exchanged through a file.
- shawnz 6y agoWSL1 also doesn't show windows proceses in 'ps', only the WSL processes. For example: shawnz@ShawnsPC:/mnt/c/Users/shawn$ ps xwau USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND root 1 0.0 0.0 8936 184 ? Ssl Nov17 0:00 /init root 6 0.0 0.0 8936 96 tty1 Ss Nov17 0:00 /init shawnz 7 0.0 0.0 18588 2708 tty1 S Nov17 0:00 -bash shawnz 252 0.0 0.0 18880 1984 tty1 R 18:04 0:00 ps xwau
- GordonS 6y ago> some scenarios have become orders of magnitude more complicated on WSL2 like connecting to a daemon on Windows or vice versa This is about my only issue with WSL2, but it's a big one. Perhaps worse than this being a problem is that Microsoft don't seem to be providing any solutions - there are various GitHub issues about it, with non-Microsoft ransoms being the ones providing workarounds (but these depend on your environment - I haven't found any way to get this working myself!). WSL1 was very ambitious. AFAIK, the main reason for shelving it's approach was filesystem performance. While it was indeed slower than native/VM, I personally never found it troublesome outside of artificial benchmarking. For the vast majority of use cases, WSL1 worked well, with Docker being the only real thing missing, IMO.
- Gene_Parmesan 6y agoRunning an npm install for an app of moderate complexity on WSL1 was such a painful experience that it turned me off of using the service for work dev entirely. Now with WSL2 it's much better, and I use it daily to the point where I have done away with my dual boot. (I still keep around a Linux notebook for edge cases.) Obviously this is only re: fs perf, I can't speak to your other issues which do seem quite challenging. But I can definitely understand why they would have seen fs perf as a priority.
- month13 6y agoFYI to any WSL2 users, in it's migrated configuration the WSL VM can request as much RAM as it needs, but has no means to free this back. There's an option to use .wslconfig to specify a limit. https://github.com/microsoft/WSL/issues/4166 https://github.com/microsoft/WSL/issues/4166
- 9HZZRfNlpR 6y agoMy problem was that the ram was never released back when I didn't use it anymore and it started to kill windows itself. Had to hard limit it from the link you provided.
- blahyawnblah 6y agoDoes "wsl --shutdown" work?
- petters 6y agoYes
- 1_player 6y ago> connecting to a daemon in Windows That doesn't seem impossible to implement. Can't you connect to some port on your gateway to access the host? Even if you currently can't, it still seems pretty easy to implement in the grand scale of things, than trying to make WSL1 work. I'd imagine it is in some todo list somewhere in Microsoft
- naikrovek 6y agoIn WSL 2 the nameserver is the Windows host OS. That's how you get the IP of the host if that's what you're talking about. export WINHOST=$(cat /etc/resolv.conf | grep nameserver | awk '{print $2; exit;}') Because the Linux VM in WSL 2 is a "different" computer, mostly, according to Windows, there may be firewall trouble, I suppose.
- pjmlp 6y agoWindows itself is a different computer, because Hyper-V is a type 1 hypervisor.
- bostonsre 6y agoMemory and cpu limits are configurable for wsl. You can cap your vm to whatever portion of your machine that you want.