Skip to content

Major performance (I/O?) issue in /mnt/* and in ~ (home) #873

Closed

Description

A brief description

As a Symfony developer, it's always been hard to get a stable/fast development environment. My current setup is a Ubuntu running under VirtualBox (using vagrant). While page generation is fast, my IDE accesses my PHP files through SMB, which is really (sometimes horribly) slow.
I'm now trying to use WSL to improve all of this. However, I'm having a major performance issue when using /mnt/* folders.
If I set up a Symfony project under /mnt/c, it is really slow. If I set it up under /home/mikael, it is very fast.

Expected results

Drives mounted under /mnt should be as fast a any other folder.

Actual results

With a new Symfony 3.1.3 project, under /home/mikael takes between 100ms and 130ms to generate the home page.
The same project under /mnt/c/ takes between 1200ms and 1500ms.

Your Windows build number

10.0.14393.51

Steps / commands required to reproduce the error

# Install PHP5
$ sudo apt-get install -y php5 php5-json

# Download Symfony installer
$ sudo curl -LsS https://symfony.com/installer -o /usr/local/bin/symfony
$ sudo chmod a+x /usr/local/bin/symfony

# Download Symfony
cd
symfony new symfony_test

# Start Symfony
cd symfony_test
php bin/console server:run

Open your browser and go to http://127.0.0.1:8000/.
Once the page is loaded, refresh it (on first request, Symfony had to generate its cache).
Generation time is displayed on the bottom left
Image

You can then do the same under /mnt/c/

cd /mnt/c/
symfony new symfony_test
cd symfony_test
php bin/console server:run

Additional information

I've added my dev folders as excluded folders in Windows Defender, as well as %LOCALAPPDATA%\lxss.
I've tried having my project in ~ and pointing my IDE to %LOCALAPPDATA%\lxss\home\mikael\ but as I've later read, there is no supported way of editing WSL files.
WSL is installed in its default location under C (no strange junction or symlink), which is a healthy SSD.
My computer is attached to a domain, if this might have any influence.

Activity

  1. changed the title [-]Major performance (I/O?) issue[/-] [+]Major performance (I/O?) issue in /mnt/*[/+] on Aug 11, 2016
  2. fcicq commented on Aug 12, 2016

    @fcicq

    with the current design of DrvFs, I guess this problem is hard to resolve. I recommend you to run a ssh server inside WSL and do the edit via ssh to bypass some other issues.

    from https://blogs.msdn.microsoft.com/wsl/2016/06/15/wsl-file-system-support/
    "DrvFs also disables directory entry caching to ensure it always presents the correct, up-to-date information even if a Windows process has modified the contents of a directory."

  3. fpqc commented on Aug 12, 2016

    @fpqc

    Also Mikael Peigney (@Mika56) the devs have said they are working on improving performance by redesigning parts of how file I/O works. That's probably why they haven't documented exactly how it works yet, since it is very much in flux at the moment.

  4. ajaykagrawal commented on Aug 12, 2016

    @ajaykagrawal

    there is no supported way of editing WSL files

    I wonder how difficult it would be for popular IDE and text editors to become WSL aware and preserve the attribute of WSL files (the security model may have some inconsistencies but I might be ok with it)

  5. fpqc commented on Aug 12, 2016

    @fpqc

    Ajay Agrawal (@ajaykagrawal) Some text-editors have an ability to save in-place rather than overwrite. I heard someone say that they enabled that setting in one or another text editor and it worked.

  6. ajaykagrawal commented on Aug 12, 2016

    @ajaykagrawal

    Thanks fpqc. I don't quite know what save in-place means but I hope more editors are updated to have this ability

  7. Mika56 commented on Aug 12, 2016

    @Mika56
    Author

    fcicq (@fcicq) I'm using an IDE for a reason :) I need my IDE, and mounting a folder through SSH, FTP, SMB or whatever would be no improvement on my current environment

  8. fpqc commented on Aug 12, 2016

    @fpqc

    Ajay Agrawal (@ajaykagrawal) Basically instead of writing a new file and saving over it, the text editor has a delta and applies it to the file, at least that's my guess.

  9. aseering commented on Aug 12, 2016

    @aseering
    Contributor

    In the old days, whenever you hit "save", text editors saved into your existing file. This was simple and efficient, but if your editor crashes or was killed mid-save, or if you run out of disk space, or if anything eelse weird happens, you might end up with a corrupt garbled mess that's half the old file and half the new file. Or it might just be completely empty / wipe out all of your data entirely, if your app implemented "save" with an initial truncate, which is easy to do by default on Linux at least.

    These days, text editors almost always "save" by creating a temporary file in the same directory, writing the entire new file contents to the temporary file, and then moving the temporary file on top of the old file, overwriting the old file in the process. "Move" within a directory is guaranteed in most cases to be strictly atomic -- even if your computer loses power mid-Move, you'll always be left with either the new file or the old file; not a corrupted intermediate.

    Clever, right? Saves lots of "I lost my data!" headaches. Thing is, if an application creates an arbitrary new file, there's no way for the OS to know that it's supposed to have the same magic permissions as some other existing file. That's what's breaking WSL.

    Some editors let you go back to the old-style behavior. Has more risk, but avoids issues in some situations.

  10. fpqc commented on Aug 12, 2016

    @fpqc

    Adam Seering (@aseering) it looks like Windows move preserves those attribs, or at least robocopy does?

  11. aseering commented on Aug 12, 2016

    @aseering
    Contributor

    Read more carefully: It does an excellent job of preserving the attributes of the wrong file :-)

    [EDIT] I can't speak for robocopy, just regular move, but what you want in this scenario is the opposite of what you want in most scenarios.

  12. fpqc commented on Aug 13, 2016

    @fpqc

    Adam Seering (@aseering) yep I am aware. I just thought that Windows commandline tools preserve even hidden ntfs attributes (moving is different from editing a file, since the atomic operation is done at the filesystem level, I think) like robocopy does.

  13. aseering commented on Aug 13, 2016

    @aseering
    Contributor

    fpqc -- ah, I see what you're getting at. Yeah, applications can copy extended attributes, if they're programmed to do so correctly.

  14. Adraesh commented on Aug 16, 2016

    @Adraesh

    Exactly the same "issue" detailed above, as I am as well a Symfony dev.

    My SF projects are all located into /mnt/d/.... my apache2 server (running on ubuntu bash) root folder is linked using a symlink and the perfs are aweful ...

    This also lead to some issue with Symfony cache system btw.

  15. baroso commented on Sep 7, 2016

    @baroso

    I've not noticed any performance issues with my IDE IntelliJ/PHPStorm, but the execution of PHP/Symfony code (running LAMP/Symfony with SuluCMS installed) ist between 4-10 times slower (total execution time) than on a normal Ubuntu system ...

    WSL 14915
    image
    second run
    image

    Ubuntu 14.04
    image
    second run
    image

    Why is it so slow?
    Are there any workarounds, maybe moving the vendors folder of Symfony?

    If you can fix this issue, it will be the best environment for developing true DOT.NET and true PHP on Windows!!!
    Thanks, keep up the great work!!!

  16. 294 remaining items

  17. Gabrielcarvfer commented on Oct 30, 2019

    @Gabrielcarvfer

    Kind of weird, but I've noticed that WSLv2 can be much slower (>1000x) than WSLv1 while working with CMake on (/mnt/*). Strace -c results

  18. slikts commented on Oct 30, 2019

    @slikts

    WSL 2 is supposed to be faster only if you use the Linux filesystem.

  19. Gabrielcarvfer commented on Oct 30, 2019

    @Gabrielcarvfer

    chx I'm not running a generic benchmark, so I would recommend you to run the tests with your application.

    Reinis Ivanovs (@slikts) Doesn't seem to be the case with /home/*/. It is ~3x faster than WSLv2 /mnt, but still >10x slower than WSLv1 (I reran with WSLv1. I've forgotten to remove the cache before running...). Strace -c results

  20. MichaelJCole commented on Nov 10, 2020

    @MichaelJCole

    I wish this problem was as easy as saying "NTFS is slow" or "DrvFs is slow".

    Sven Groot (@SvenGroot), thanks for your post and explanation. I left Windows for Linux around NT and now I'm back.

    You mentioned a workaround to move files off C: to D: so as to skip some of the filters causing slow downs.

    I symlink from C: into Ubuntu's root so I can use graphical editors without having to go full XWindows.

    $ ls
    lrwxrwxrwx  1 michael michael       23 Nov  5 12:01 'Unreal Projects' -> '/mnt/c/Unreal Projects/'
    lrwxrwxrwx  1 michael michael       23 Nov  5 14:11  webproject -> /mnt/c/webproject
    

    Given what is (and 2 years of experience), are there any other workarounds?

  21. DemiMarie commented on Nov 10, 2020

    @DemiMarie

    One idea I just had for WSL to have its own metadata cache, and to add a filter driver that invalidates the cache when necessary.

  22. yay commented on Sep 8, 2022

    @yay

    Basically, this isn't a simple problem

    Sven Groot (@SvenGroot) I thought Microsoft is making money solving hard problems (like amazing Github Copilot stuff and natural text-to-speech). Any progress on those items after 4 years?

  23. GrimzEcho commented on Oct 11, 2023

    @GrimzEcho

    Just changing to a moderately large project directory (~20,000 files) on /mnt via cd takes almost 5 minutes to complete. This happens for each new terminal that accesses the folder.

    It's disappointing that this is still a big issue 7 years after the ticket was opened.

  24. ylluminate commented on Oct 11, 2023

    @ylluminate

    @BrianHVB curious, while I don't use Windows anymore for development (macOS), does this happen with WSL2?

  25. GrimzEcho commented on Oct 11, 2023

    @GrimzEcho

    ylluminate (@ylluminate) Yes - it is specific to WSL 2. I haven't used WSL 1 in almost two years, but I never encountered the same performance issues (on the same 20,000 file repo).

    Putting the repo under WSL-Linux's virtual disk (e.g. in the /home) folder eliminates the issue, but then the only way you can access the files from the container is over a network share, and that causes problems for JetBrains IDEs and other tools. It also means having to maintain two separate repositories if you need to work on the project from both Windows and Linux contexts.

  26. EmpiricEmpire commented on Oct 11, 2023

    @EmpiricEmpire

    Putting the repo under WSL-Linux's virtual disk (e.g. in the /home) folder eliminates the issue, but then the only way you can access the files from the container is over a network share, and that causes problems for JetBrains IDEs and other tools. It also means having to maintain two separate repositories if you need to work on the project from both Windows and Linux contexts.

    Well, if you're onto workarounds, why don't you just install a Linux distro?

  27. GrimzEcho commented on Oct 11, 2023

    @GrimzEcho

    Empiric Empire (@EmpiricEmpire) Do you mean installing a Linux distribution under WSL 2? I have several, that is where this problem is originating. I want to operate on the project's source code using Windows-based GUI tools such as my JetBrain's IDEs, while compiling and running the project in Linux via WSL 2.

  28. EmpiricEmpire commented on Oct 11, 2023

    @EmpiricEmpire

    Empiric Empire (@EmpiricEmpire) Do you mean installing a Linux distribution under WSL 2? I have several, that is where this problem is originating. I want to operate on the project's source code using Windows-based GUI tools such as my JetBrain's IDEs, while compiling and running the project in Linux via WSL 2.

    Well, clearly you have a distro under a WSL 😄 I just googled and JetBrain produces Linux binaries of their IDE. But even if it wouldn't you could run it under WINE just fine performance-wise, so… 🤷

  29. EmpiricEmpire commented on Oct 11, 2023

    @EmpiricEmpire

    @BrianHVB sorry, don't get me wrong, I get you used to Windows and why would you switch, etc… Which is exactly why my first message started with "if you're onto workarounds". It's just that having a single repo might be easier, that's all 🤷 Not insisting tho, do whatever you like.

  30. microsoft-github-policy-service commented on Sep 25, 2025

    @microsoft-github-policy-service
    Contributor

    This issue has been automatically closed since it has not had any activity for the past year. If you're still experiencing this issue please re-file this as a new issue or feature request.

    Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions