MicrosoftDocs / WSL

Source code behind the Windows Subsystem for Linux documentation.
https://docs.microsoft.com/windows/wsl
Other
1.91k stars 563 forks source link

mvn install build jar package is very slow #604

Closed kioyong closed 2 years ago

kioyong commented 4 years ago

i try to build any jar package is very slow in WSL2, refer screenshot, in PowerShell is fast powerShell in wsl2 (Ubuntu 18) wsl2

oldium commented 4 years ago

It looks like you are comparing native filesystem access (Windows/Powershell on c:\Users) with proxy access (WSL2 virtual machine accessing Windows files on /mnt/c/Users -> c:\Users). Copy your files to /root and try to build it there instead of using Windows paths. WSL2 is a virtual machine having its own virtual disk, so use that one to gain performance.

craigloewen-msft commented 2 years ago

As oldium above mentioned please place your files in the Linux file system and you'll see a much higher performance difference! Thanks for filing.

tonycody commented 1 year ago

As oldium above mentioned please place your files in the Linux file system and you'll see a much higher performance difference! Thanks for filing.

This will be troublesome. The application scenario is as follows:

  1. Common code in the Windows file system, such as: D drive root directory. D:\githome
  2. Do development in a Windows environment, but sometimes you need to use a different JDK to build your project. Switching between different JDK versions is easier on Linux.
  3. You can reduce the cost of git checkout by directly accessing files in the Windows file system path on Linux, and you don't need to have two git projects in different locations.

Look for ways to improve performance across file systems. This is the value of the WSL2 subsystem on Windows.

tonycody commented 1 year ago

As oldium above mentioned please place your files in the Linux file system and you'll see a much higher performance difference! Thanks for filing.

If the WSL2 file system is not accessible and is no different from other virtual machines, why use WSL2? If the WSL2 and Windows file systems can access each other, but the performance is very poor, that means their value is very low. If you use WSL2 and need to operate within the WSL2 Linux subsystem file system because of the poor performance of file system mutual access, then basically there is no value in using the WSL2 subsystem, and I can achieve the same goal with VirtualBox and VMWare.

@kioyong @oldium

oldium commented 1 year ago

As oldium above mentioned please place your files in the Linux file system and you'll see a much higher performance difference! Thanks for filing.

If the WSL2 file system is not accessible and is no different from other virtual machines, why use WSL2?

Full WSL2 file system is accessible from Windows.

If the WSL2 and Windows file systems can access each other, but the performance is very poor, that means their value is very low.

You have native access (fast) and proxy access (slow). Use whatever fits your needs.

If you use WSL2 and need to operate within the WSL2 Linux subsystem file system because of the poor performance of file system mutual access, then basically there is no value in using the WSL2 subsystem, and I can achieve the same goal with VirtualBox and VMWare.

It is slow for some specific use cases (like building projects with lots of files). Other use cases work just fine. There is also possibility to run GUI applications.

It looks like you are new to WSL2 (according to newly created issues), so I recommend reading official documentation to get information on what it can do and what are limitations.

tonycody commented 1 year ago

As oldium above mentioned please place your files in the Linux file system and you'll see a much higher performance difference! Thanks for filing.

If the WSL2 file system is not accessible and is no different from other virtual machines, why use WSL2?

Full WSL2 file system is accessible from Windows.

If the WSL2 and Windows file systems can access each other, but the performance is very poor, that means their value is very low.

You have native access (fast) and proxy access (slow). Use whatever fits your needs.

If you use WSL2 and need to operate within the WSL2 Linux subsystem file system because of the poor performance of file system mutual access, then basically there is no value in using the WSL2 subsystem, and I can achieve the same goal with VirtualBox and VMWare.

It is slow for some specific use cases (like building projects with lots of files). Other use cases work just fine. There is also possibility to run GUI applications.

It looks like you are new to WSL2 (according to newly created issues), so I recommend reading official documentation to get information on what it can do and what are limitations.

Is it good for users to use the scene? It's what the user needs to do, not what I'm supposed to do.

Take the Java project. I am the code directory in the C:\ Users\ XS\ githome\ java-samples directory. I am now developing this project through Jetbrains on Windows. Use JDK8. I want to compile this project through JDK19. There is no JDK19 on Windows, but WSL2 linux contains JDK19. I just want to build it. This is a common usage scenario!

tonycody commented 1 year ago

As oldium above mentioned please place your files in the Linux file system and you'll see a much higher performance difference! Thanks for filing.

If the WSL2 file system is not accessible and is no different from other virtual machines, why use WSL2?

Full WSL2 file system is accessible from Windows.

If the WSL2 and Windows file systems can access each other, but the performance is very poor, that means their value is very low.

You have native access (fast) and proxy access (slow). Use whatever fits your needs.

If you use WSL2 and need to operate within the WSL2 Linux subsystem file system because of the poor performance of file system mutual access, then basically there is no value in using the WSL2 subsystem, and I can achieve the same goal with VirtualBox and VMWare.

It is slow for some specific use cases (like building projects with lots of files). Other use cases work just fine. There is also possibility to run GUI applications. It looks like you are new to WSL2 (according to newly created issues), so I recommend reading official documentation to get information on what it can do and what are limitations.

Is it good for users to use the scene? It's what the user needs to do, not what I'm supposed to do.

Take the Java project. I am the code directory in the C:\ Users\ XS\ githome\ java-samples directory. I am now developing this project through Jetbrains on Windows. Use JDK8. I want to compile this project through JDK19. There is no JDK19 on Windows, but WSL2 linux contains JDK19. I just want to build it. This is a common usage scenario!

For this scenario, the problem now is that when the code file is on the Windows file system, maven and JDK are slow to build the code on the Windows file system in WSL2 linux. Why do I have to copy the code to the WSL2 Linux file system? If so, the VirtualBox virtual machine can also do it, so why use WSL2?

oldium commented 1 year ago

Install Temurin JDK19 https://adoptium.net/temurin/releases?version=19 if you need JDK19. This is not a support forum, this is a closed ticket.

WesleyBlancoYuan commented 1 year ago

Even I understand WSL has some limitations in cross filesystem access only when it comes to lots of files(like in cases of Maven build), I don't find it satisfactory and cannot persuade myself that it's reasonable. Although I don't agree with the statement of "Why should I use WSL if VirtualBox has the same performance" as anyone can decide what product to use or not/("No one forces you to use WSL!"), I think more explanations could be done by dev team from MS side.

I found this https://stackoverflow.com/questions/68972448/why-is-wsl-extremely-slow-when-compared-with-native-windows-npm-yarn-processing, stating that:

I hope these could help someone coming to here in the future.