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
ssh.exe uses 25% of CPU (quad core processor) #1076
Comments
Thanks @darkdragon-001 for posting. To clarify -- is this unexpected given your particular network setup? rsync uses ssh to transfer data securely over the network, and ssh does some heavyweight encryption. If the network connection between your machines is fast, and/or your CPU is slow, then it's very possible that ssh won't be able to encrypt data fast enough to keep up. In which case you'll see it using a full CPU core (25% on a quad-core machine). ssh can be configured to use less CPU-intensive (and theoretically less secure) encryption, if that's what you're looking for. |
8 MBit/s = 1MB/s upstream, Intel Core 2 Quad Q9550 @ 2.83 GHz Maybe I setup a computer connected with Gigabit to test maximum transfer speed... |
For what it's worth, the Core 2 Quad Q9550 is an 8-year-old chip. It's relatively old and slow compared to newer processors. I feel like that chip ought to be able to push a little more than 8mbits over ssh, but not a whole lot more, and maybe newer versions of ssh are negotiating more CPU-intensive encryption schemes? Do you have reason to believe that this machine could transfer data significantly faster and/or with less CPU utilization using a real Ubuntu 14.04 installation or VM on the same hardware? |
A 1.86ghz Core 2 should be able to push around 139MiByte/s using aes128-ctr, which is the default mode for ssh on Ubuntu. You can do ~13MByte/s on a 200Mhz Pentium II. No idea why his core is maxed, mind. |
It has not been my experience that ssh itself achieves those speeds on this hardware... Do you have a benchmark of it (rather than an alternate implementation of just the algorithm) that you can cite? |
Hm... I think perhaps the truth is somewhere in the middle: I used to use an old MacBook Pro with a Core 2 2.33ghz as my main computer. I just dug it out and tried running rsync from it using the OP's arguments. I was able to sustain in the neighborhood of 25MB/sec. Which is considerably slower than 139MB/s, but considerably faster than 1MB/sec. I'm seeing around 15MB/sec from WSL, on a machine with a Core i7-6500U. Not that old-Mac to new-WSL is a very meaningful comparison... The receiving server was running native Ubuntu 14.04 in both cases. It's worth observing that the OP is using a compressed data stream ( @darkdragon-001 -- do you have any customizations in |
So I don't think this should affect the speed... |
What kind of machine are you rsync'ing to? Another machine running WSL and Ubuntu's OpenSSH? An Ubuntu server (what version)? Some other Linux? Something else entirely? If you're willing to post the output of |
Your new numbers seem about right. Here's a dude from 2009 getting 23.7MByte/s between his AMD Athlon 4600 and a Core 2 Mac. These are all pre AES-NI instruction machines. On my circa 2011 i7 with AES-NI I am getting around 150MB/s (~1.2Gbit/s) on WSL with |
For most of the next tests, I omitted the Test1: Ubuntu 16.04 with SSD connected via Gigabit Ethernet to Windows 10 WSL with SSD (without Test2: Windows 10 WSL with SSD connected via Gigabit Ethernet to Ubuntu 16.04 with SSD (with Test2.5: Windows 10 WSL with SSD connected via Gigabit Ethernet to Ubuntu 16.04 with SSD (without Test3: Windows 10 WSL with SSD connected via Internet (50 MBit/s down, 10 MBit/s up) to Ubuntu Server 16.04.01 LTS (without |
Hm... That's very interesting. If you run rsync with Also, would it be possible to test copying from the Ubuntu 16.04 with SSD machine to the Ubuntu Server machine? Just to see how ssh behaves with WSL out of the picture entirely. |
Great tests. I wonder we're really just seeing something like #981 here. How about just:
|
@therealkenc -- ah, another good test. For what it's worth, if none of the above tests turn up anything, I'm wondering if it's related to #971 (which I'm not immediately sure how to test for). |
Unfortunately, I have some problems with my server so I could only do local tests. I used 3 machines with SSDs connected via Gigabit Ethernet:
* indicates that
I noticed the following:
|
Great you took the effort to test this more. Can you explain [3/5; 4/8] -- apologies, it will be obvious once you do (threads?). These numbers look pretty reasonable, considering, no? I mean, based on the numbers I've seen online for "older" machines (ie without AES-NI) you're being limited by AES not your GigE local net. We're getting pretty pedantic at this point, but you could try doing the same One thing I left unmentioned up-post is that AES proper (any implementation) isn't going to cross out of userspace, so this shouldn't theoretically be in WSL's wheelhouse. The WSL emulation layer doesn't even know your data is encrypted. What I was really looking for was WSL related overhead in either the fs or tcp system calls. That's really the only place you should be seeing any WSL influence here. |
This issue went stale without comment from the team, but I can confirm something is going on here; I am just not sure what. Note the 374.88K bytes/sec below. This is
|
I have experienced this also while compiling Ruby. It seems there are several issues related, not to a specific command, but rather overall to WSL being limited to 25% of CPU. Is this limit an intentional feature of WSL? I'd like to increase this limit if possible. See also #358 |
Essentially a discussion thread that ran course. A single threaded compile or single threaded ssh can (and will) max out a CPU if that's the bottleneck (contrast disk or network io). There's no known limitation specific to WSL in that regard (if WSL couldn't use all CPUs people's heads would explode). It is possible (but improbable) there are scenarios where WSL behaves different from the Real Thing for reasons, but in the event that is the case what would be needed to track further would be a test case with a tight repro. |
When copying file via
rsync -ahvzP --append-verify ./source user@host:/destination
, the processssh.exe
consumes 25% of CPU.The text was updated successfully, but these errors were encountered: