kvlnkarthik commented on issue #485:
URL: https://github.com/apache/mina-sshd/issues/485#issuecomment-2061827392
We see same issue in our tests as well. We are using 2.12.1 version.
We executed filetransfer test case using Files.copy() approach for
transferring a file of about 167Mb to a remote server and took it around
30seconds.
If we transfer the same file from same system to the same remote server but
with sftp session created with below commands, it takes around **6 minutes** to
complete the transfer. Performance is very much degraded in this scenario.
" sftp -P 2022 <username>@localhost"
put <filename> /tmp/
We run the SSHD server with sftp subsystem and a custom FileSystemFactory
which creates a remote sftp filesystem created using below code in localhost
and initiate the above sftp commands from command line terminal.
` URI sftpUri =
SftpFileSystemProvider.createFileSystemURI(sshConnectionDetails.getHostname(),
sshConnectionDetails.getSshPort(),
sshConnectionDetails.getUsername(),
sshConnectionDetails.getPassword());`
Apache Mina code runs on localhost 2022 but creates a remote filesystem. So,
when we execute the put <filename> /tmp/, the file gets transferred from our
local system to remote server. i.e., client -> apache mina server -> remote
server.
We acknowledge that there is an additional hop here, i.e., the file needs to
be transferred to server and then to remote server but the transfer rate is way
too slow.
We see SftpRemotePathChannel.write method invocations during this mode of
transfer in the thread dump. Based on our tests and your explanation in
previous comments, this mode of transfer seems to be very slow.
Stack trace:
"sshd-SftpSubsystem-47114-thread-1" #35 daemon prio=5 os_prio=0
tid=0x00007f7cf4070800 nid=0x18e88 in Object.wait() [0x00007f7d30ffc000]
java.lang.Thread.State: TIMED_WAITING (on object monitor)
at java.lang.Object.wait(Native Method)
at java.lang.Object.wait(Object.java:460)
at
org.apache.sshd.sftp.client.impl.DefaultSftpClient.receive(DefaultSftpClient.java:351)
- locked <0x000000071c95faa0> (a java.util.HashMap)
at
org.apache.sshd.sftp.client.impl.DefaultSftpClient.receive(DefaultSftpClient.java:325)
at
org.apache.sshd.sftp.client.impl.AbstractSftpClient.response(AbstractSftpClient.java:181)
at
org.apache.sshd.sftp.client.impl.AbstractSftpClient.rpc(AbstractSftpClient.java:169)
at
org.apache.sshd.sftp.client.impl.AbstractSftpClient.checkCommandStatus(AbstractSftpClient.java:233)
at
org.apache.sshd.sftp.client.impl.AbstractSftpClient.write(AbstractSftpClient.java:783)
at
org.apache.sshd.sftp.client.fs.SftpFileSystem$Wrapper.write(SftpFileSystem.java:422)
at
org.apache.sshd.sftp.client.impl.SftpRemotePathChannel.doWrite(SftpRemotePathChannel.java:266)
- locked <0x000000071cd40f08> (a java.lang.Object)
at
org.apache.sshd.sftp.client.impl.SftpRemotePathChannel.write(SftpRemotePathChannel.java:202)
at org.apache.sshd.sftp.server.FileHandle.write(FileHandle.java:161)
at
org.apache.sshd.sftp.server.SftpSubsystem.doWrite(SftpSubsystem.java:884)
at
org.apache.sshd.sftp.server.AbstractSftpSubsystemHelper.doWrite(AbstractSftpSubsystemHelper.java:605)
at
org.apache.sshd.sftp.server.AbstractSftpSubsystemHelper.doProcess(AbstractSftpSubsystemHelper.java:362)
at
org.apache.sshd.sftp.server.SftpSubsystem.doProcess(SftpSubsystem.java:355)
at
org.apache.sshd.sftp.server.AbstractSftpSubsystemHelper.process(AbstractSftpSubsystemHelper.java:344)
at
org.apache.sshd.sftp.server.SftpSubsystem.run(SftpSubsystem.java:331)
at
java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:750)
Is there any way to force/override the file upload/download in sftp sessions
through put/get commands to use Files.copy() way in order to see better
performance or tune buffers in SftpRemotePathChannel. Could you please let me
know.
Also observed that if we simply use sftp openssh client to the remote server
directly without going through our Apache Mina Sftp server code, it takes only
3seconds to transfer the same file.
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]