microsoft / WSL

Issues found on WSL
https://docs.microsoft.com/windows/wsl
MIT License
17.46k stars 822 forks source link

Performance issues a networking #3457

Closed ghost closed 9 months ago

ghost commented 6 years ago

Microsoft Windows [Version 10.0.17134.165]

I'm doing some server software benchmarks on Windows. I have code that is cross-platform and known to be efficient on Linux and I'm trying to map out how well the Windows port of it performs.

Running the server software on Windows gives good/reasonable performance, but running the Linux original code in WSL results in significantly worse performance/unreasonably slow. I get around 1/8 the performance in WSL compared to running the ported code natively on Windows outside of WSL. This makes no sense at all and the numbers I get are very poor.

In this particular case a very "polling-intense" benchmark was used. That is, it basically just opens a couple of TCP connections and starts ping/pong:ing between server and client software. The server is always stressed to 100% CPU time for the one thread it runs in.

See our contributing instructions for assistance.

therealkenc commented 6 years ago

Will give this a short chance but please see CONTRIBUTING.md else this is quick dupe #2864 #2477 et al.

For WSL launch issues, please collect detailed logs. N/A

It is /A -- notably an strace with timestamps with a comparison against Real Linux will help indicate any performance diverge you are experiencing.

ghost commented 6 years ago

Reproducing can be done in a few simple steps with git and a C compiler:

git clone https://github.com/uNetworking/uSockets.git cd uSockets make

Now run ./http_server in one terminal and ./http_load_test 40 localhost 3000 in another one.

Perform this in WSL and then in a real Linux. Difference in perf. is 10x:

Real Linux: 346k Native Windows port: 220k WSL Linux: 34k

ghost commented 6 years ago

You can also reproduce it by compiling the well-used wrk benchmarking tool (https://github.com/wg/wrk) and run it against any fast HTTP server on the network. Wrk will perform about 10x worse in WSL than in a native Linux. This makes it impossible to benchmark fast servers as the client (wrk) becomes the bottleneck and thus reports invalid results.

microsoft-github-policy-service[bot] commented 9 months ago

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!