[PR] Add missing U2F ed25519-sk public key equality methods [mina-sshd]
lf- opened a new pull request, #486: URL: https://github.com/apache/mina-sshd/pull/486 This fixes a bug where Gerrit Code Review (3.8.2, at least) does not properly admit U2F based SSH keys, and they get rejected mysteriously on authentication. -- 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
Re: [I] Perfomance file transfer [mina-sshd]
tomaswolf commented on issue #485: URL: https://github.com/apache/mina-sshd/issues/485#issuecomment-2060039475 After some analysis, here's what's going on: transferTo/transferFrom, as well as the FileChannel.write() operations, are _positional_ operations. `readableChannel.transferTo(0, length, writeableChannel)` will essentially read 8kB `ByteBuffer`s from the file and then call `writeableChannel.write()` for each buffer. However, `SftpRemotePathChannel.write()` doesn't know that it is being called essentially for a sequential copy operation, and so it doesn't employ a number of optimizations. The result is the slow transfer. If you change the logic and use `writeableChannel.transferFrom()`, then the `SftpRemotePathChannel` drives the operation, and it knows that it is going to sequentially read buffers. Hence it can employ these optimizations. When you use OutputStream/InputStream as in my `Files.copy()` examples, then it is known that a sequential data transfer occurs, and the SFTP implementation can employ its optimizations unconditionally. Finally, transferTo/transferFrom by default copy data in 8kB chunks. With streams, the chunks are about 32kB. This difference causes the 25% slowdown. Hence: - In general, using streams is the simplest for downloading and uploading files, and gives good performance. - If you want to use `FileChannel`s: - Always let the remote channel drive the operation. Use transferFrom for uploading and transferTo for downloading. - Execute transferTo/From in a loop until all data has been transferred. - Increase the transfer buffer size via `SftpModuleProperties.COPY_BUF_SIZE.set(session, 32 * 1024);` It might be possible to improve our implementation to handle the case you stumbled upon better, but I'm not sure yet. -- 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
Re: [I] Perfomance file transfer [mina-sshd]
tomaswolf commented on issue #485: URL: https://github.com/apache/mina-sshd/issues/485#issuecomment-2059973935 Interesting: if you change in your code ``` readableChannel.transferTo(0, length, writeableChannel); ``` to ``` writeableChannel.transferFrom(readableChannel, 0, length); ``` it will also run much faster (but still 25% slower than the two versions with `Files.copy()` I posted). Off-topic note: you should probably also check the return value of transferTo/transferFrom and execute them in a loop until everything is transferred. -- 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
Re: [I] Perfomance file transfer [mina-sshd]
tomaswolf commented on issue #485: URL: https://github.com/apache/mina-sshd/issues/485#issuecomment-2059918256 Thank you for this test case. It appears that there is indeed something wrong with the `FileChannel`s. The following is in my tests much faster (and on par with OpenSSH or Jsch): ``` SftpClient sftpClient = SftpClientFactory.instance().createSftpClient(session); try (OutputStream out = sftpClient.write("largeFile")) { Files.copy(new File(largeFile).toPath(), out); } ``` or also ``` try (SftpFileSystem fs = SftpClientFactory.instance().createSftpFileSystem(session)) { Path remoteFile = fs.getPath("largeFile"); Files.copy(new File(largeFile).toPath(), remoteFile, StandardCopyOption.REPLACE_EXISTING); } ``` With the channels and `transferTo` I see uploads (to localhost, so no network latency) about 4 times (400%) slower, and downloads about 25% slower. We'll have to investigate what's going on there... What is the JSCHED library? -- 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
[I] Perfomance file transfer [mina-sshd]
Holger-Benz opened a new issue, #485: URL: https://github.com/apache/mina-sshd/issues/485 ### Version 2.12.1 ### Bug description Dear apache support team, we are switching our communication software from the JSCHED sftp library to the apache-mina library. We realized that the apache mina library does not reach the performance of the JSCHED library. I have written a small program to send a 700 MB file using the SFTP protocol. This file transfer is about 6 times slower than a file transfer with the JSCHED library. How can we increase the transfer speed? Are we not using the apache-mina library correctly? public static void sendFile() throws IOException { SshClient client = SshClient.setUpDefaultClient(); client.start(); try (ClientSession session = client.connect("user", "host", 1022).verify().getClientSession();) { session.addPasswordIdentity("password"); session.auth().verify(); SftpClient sftpClient = SftpClientFactory.instance().createSftpClient(session); String largeFile = "c:/temp/largeFile"; long length = new File(largeFile).length(); try (FileChannel writeableChannel = sftpClient.openRemoteFileChannel("largeFile", SftpClient.OpenMode.Create, SftpClient.OpenMode.Truncate, SftpClient.OpenMode.Write); FileChannel readableChannel = FileChannel.open(new File(largeFile).toPath(), StandardOpenOption.READ)) { readableChannel.transferTo(0, length, writeableChannel); } } } ### Actual behavior The apache mina library does not reach the performance of other sftp-libraries ### Expected behavior Is it possible to increase the perfomance? ### Relevant log output _No response_ ### Other information _No response_ -- 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.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