tomaswolf commented on issue #524: URL: https://github.com/apache/mina-sshd/issues/524#issuecomment-2210425913
This problem definitely is specific to Windows. It does not occur on OS X. (Didn't test Linux.) The problem occurs with both the NIO2 and the netty I/O back-end. (Didn't try MINA.) Performance with either back-end is the same. So it's not an I/O back-end problem. The problem also definitely is _not_ in the SFTP layer. I performed and timed a direct file upload via the equivalent of `cat local_file | ssh user@somehost 'cat > remote_file'` with Apache MINA sshd: ``` try (ChannelExec exec = session.createExecChannel("cat > upload/testfile.bin")) { exec.setStreaming(Streaming.Async); exec.open().verify(); long start = System.currentTimeMillis(); try (InputStream localInputStream = Files.newInputStream(localFile)) { IoOutputStream out = exec.getAsyncIn(); byte[] buf = new byte[32 * 1024]; int n = 0; while ((n = localInputStream.read(buf)) >= 0) { if (n > 0) { out.writeBuffer(new ByteArrayBuffer(buf, 0, n)).verify(1000); } } out.close(false); } long elapsed = System.currentTimeMillis() - start; System.err.println("Apache cat stream upload took " + (elapsed / 1000.0) + "sec"); } ``` This uploads the file without SFTP, so there is zero overhead for the SFTP protocol and its ACKs. Timing this (repeatedly) showed no significant differences from normal uploads via SFTP. Which means that the bottleneck is not in the SFTP code. (Assuming that on the server side using "cat" is not slower than "internal-sftp". The server again is OpenSSH running in an alpine:latest container.) As mentioned before, the timings are fairly inconsistent from run to run, too. (For both JSch and Apache MINA sshd.) In some runs JSch is slow, too, and Apache MINA sshd is actually faster. In some runs, both are fast (and about equal). In most runs, though, Apache MINA sshd is noticeably slower. Might be a threading issue, or a memory issue. Or a channel window issue (though then I'd expect to see the problem also on OS X). But whatever it is, it isn't in the SFTP code. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: dev-unsubscr...@mina.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@mina.apache.org For additional commands, e-mail: dev-h...@mina.apache.org