-
Notifications
You must be signed in to change notification settings - Fork 832
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[wsl2] filesystem performance is much slower than wsl1 in /mnt #4197
Comments
Can you post the results when doing the same test on a file on This is straight I/O on a single file where I would expect to see more or less the same perf between WSL1 and WSL2. My expectation was that WSL2 perf is better than WSL1 only when doing "namespace" operations (i.e. working on lots of small files, listing them, stat'ing them, etc.) As for the results on /mnt/e they are not very surprising, since I/O has to go through both the Linux and Windows file system stack in likely a new and unoptimized piece of code. |
I see, I'm assuming you're still refering to / and not /mnt folders about namespace operations. WSL 2root@LUCIANO-PC:/home/# dd if=/dev/zero of= 20000+0 records in WSL1root@LUCIANO-PC:/home/# dd if=/dev/zero of=~/testfile bs=1M count=10000 I'm thinking this has to do something with OS Caching because in task manager even though I can see the file being written, the disk usage write speed is unchanged while in wsl1 I can see it constantly at around 350mb/sec . As another interesting fact, the vmmem usage while writing the file is increasing rapidly. By the 3rd copy action all my RAM is used up (32GB). |
I'm also experiencing this after an upgrade to WSL2, only slow performance under /mnt, not /, slower than WSL1. I can post numbers as well if necessary. This is on |
I'm experiencing the same issue, |
When I run a
|
Do we know what's at the root of this, and whether there are any other workarounds than downgrading? |
@definelicht - Yep we're working on improving the performance. In the meaning working out of your root file system (the ext4 volume) will have MUCH better performance. |
Indeed after the last update I can already see much better performance on WSL2. root@LUCIANO-PC:~# dd if=/dev/zero of=/mnt/e/testfile bs=1M count=10000 That's on an SSD and it's like 6 times faster than before. Still slower then WSL1 but it's definitely improved. --correction--- |
I got
but |
I think this is a latency rather than a bandwidth issue, surfacing when a large number of files are accessed (e.g., when running |
can you share the cause of it? I'm curious |
can confirm a very bad performance on /mnt ( |
After switch configuration from WSL to WSL 2 (Build 18975), without any change on my distro, the server respond time incresed. Configuration : Debian buster Apache2.X / PHP-FPM 7.3 / MySQL WSL 1 : 0.5 sec With Docker (Ubuntu 18.04) WSL Tech preview i could not test on WSL 1, but WSL 2 takes over 30 sec... I suppose the issue is the same. |
This is my performance in a medium project: GIT_TRACE_PERFORMANCE=1 git status -sb -uno 13:20:04.630972 read-cache.c:2267 performance: 0.017249300 s: read cache .git/index File System exFat, the result is the same is other file system... |
I'm currently using the normal Docker Desktop with linux containers to run a PHP projekt during local development. The repo is in a normal Windows directory and gets mounted via volume bind in the docker container, so that I can easily manipulate the files through an IDE. The same setup on a native linux machine has always been multiple times faster and the "problem" (from what I've read) has always been attributed to the Linux VM that is used on Docker Desktop. Then WSL 2 was announced and I finally came around to set everything up. But when I ran our teststuite for the first time, I was pretty disappointed that the performance was actually much worse than before (40s on the Docker Deskop Linux VM setup vs 100s on the WSL2 setup). Subsequent investigation brought me to this thread. From what I've read here so far: Does it even make sense to switch to WSL 2 for local development yet if "bad performance" is your primary reason to do so? A "no" would be a totally acceptable answer - I just don't want to waste any more time on this if it's simply not ready yet. |
I know that wsl2 is a preview, but is there any hope that accessing \wsl$ from windows or /mnt from wsl will reach acceptable speeds? |
I'd also like to ask about this, doing a |
same with 1903 (18990.1) absolutely useless... |
I am also seeing this, accessing Windows files from the Linux environment is several orders of magnitude slower in WSL2 than in WSL1. |
But what is the performance in reading and writing large files like 1GB or more in Python for example or even copying large files in folders on ext4 partitions in WSL2? my problem today is accessing these large files on mount points for windows drives. If ext4 on Linux is as fast as the virtual drive on the WSL2 system, then the last step is to figure out how to access that Linux partition directly from Windows and copy those same files without losing performance. |
My impression of the Using Paragon Linux Filesystem:
Or using the WSL extfs mount:
On the image:
On the WSL mount of the NTFS drive:
I'd be happy to run other tests. |
This has me stumped: I don't know of a fast extfs driver for Windows. |
I don't think that will work; the file system is not meant to be used by two drivers/kernels at the same time. So even if you get it to work, it will most likely corrupt the file system. Or if one of them is just read only, it will still most likely just read stale data, due to the file caches not being in sync. And that's the whole reason why they use a network file system in the first place, otherwise WSL would already use direct mounts on both sides. But... |
I did some more digging. There has actually been quite a bit of progress of writing custom 9P drivers for QEMU https://gitlab.com/qemu-project/qemu/-/issues/974, with links to various mailing list discussions. If that was completed, I think it should be usable together with WSL2 as well. Unfortunately, it looks like the progress has stalled due to security issues. For virtiofsd, which probably would be faster, the situation doesn't look as promising https://gitlab.com/qemu-project/qemu/-/issues/623. Windows guest support exist, but I don't think the drivers can be installed and work on a physical machine. So, we need host driver support, where WSL would be a guest. |
I finally got this working with an ext4 vhdx and it actually works really fast. The only problem is that to access via Windows you need to access the Linux mount point as is done when viewing the contents of the WSL distribution disk. So I can only access the path '\wsl.localhost\distro\home\user' if Linux is running. I'll try to repeat creating a vhdx in ntfs format, because if it works I'll be able to mount the vhdx in Windows when I'm not using it within WSL. Then I will structure the step by step and send the link here for anyone who wants to try it. |
Ive tested NTFS mount and it is really only 110mb/s transfer speed while in ext4 i got 2gb/s like direct nvme writing. |
when i tranfser file to xfs via wsl2 and i fell like my speed is often limited around 1Gbps(100 to 125MiB/s) or 2Gbps(180 to 200MiB/s) |
Docker build on |
6.1 kernel doesn't make a huge change.
Compare to ext4 on WSL2
|
Hi @benhillis, any news on the issue? Mounting an external drive has around 1/10 of the Performance it is on native windows. The external drive is necessary however. Is there a workaround to increase read/write performance on mounted drives in wsl2? Thanks in advance for the help. |
Using ext4 file system on mounted drives will give you “near native” performance |
Thanks for the quick reply 👍 I will try that. |
To mount a drive on WSL startup
and then querying devices with
(You might want to use
(replace the UUID in the script with the one you found out in step 2 and adjust the mount point to your liking) The idea of calling WSL to mount the drive from within WSL at bootup is absurd and genious :-) (source: #6073) |
Just keep in mind that drive then is removed fully from windows side and it's no longer accessible there directly Only through wsl |
I decided to open this as a separate issue because although it's related to the generic issue of filesystem performance it's directly related to WSL 2 while the other issues are for WSL 1 and it's showing very conflicting results.
Your Windows build number: (Type
ver
at a Windows Command Prompt)Version 10.0.18917 Build 18917
What you're doing and what's happening:
I'm testing filesystem write speed in /mnt using dd command. Performing the following tests
WSL2
root@LUCIANO-PC:/home/# dd if=/dev/zero of=/mnt/e/testfile bs=1M count=1000
1000+0 records in
1000+0 records out
1048576000 bytes (1.0 GB, 1000 MiB) copied, 25.939 s, 40.4 MB/s
WSL1
root@LUCIANO-PC:/home/# dd if=/dev/zero of=/mnt/e/testfile bs=1M count=20000
20000+0 records in
20000+0 records out
20971520000 bytes (21 GB, 20 GiB) copied, 47.4897 s, 442 MB/s
On / it's actually the reverse. WSL2 is more than 2 times faster than WSL1.
I would expect the filesystem performance in /mnt to at least be on the same level but it's over 10 times slower.
Another interesting fact is that if I mount the same drive as a cifs share I get 3x performance
WSL 2 (cifs share)
root@LUCIANO-PC:/mnt/sambae# dd if=/dev/zero of=/mnt/sambae/testfile bs=1M count=10000
10000+0 records in
10000+0 records out
10485760000 bytes (10 GB, 9.8 GiB) copied, 84.001 s, 125 MB/s
An update of the current status because it's way too hidden in this thread.
Latest status report: #4197 (comment)_
The text was updated successfully, but these errors were encountered: