[ https://issues.apache.org/jira/browse/SSHD-812?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16430013#comment-16430013 ]
Goldstein Lyor commented on SSHD-812: ------------------------------------- I agree that {quote} reads from a single handle would still be synchronized {quote} However, I am not sure we want to complicate the SFTP code so much, so I am going for a compromise. Using synchronized access to the file handle we still get *some* concurrency if we take into account the I/O overhead of reading the command and/or writing the response. Since the lock on the file handle is as short as possible - only for reading the actual data, while one thread is busy encoding the result and sending it back, another thread can lock and read its data block. I agree it is not the most optimized solution, but it does provide quite useful concurrency if reading/writing from multiple files, executing multiple non-handle related commands concurrently, etc... As far as {quote} have the subsystem implement AsyncCommand instead of the simple Command {quote} I believe this would entail quite a few more changes than I am willing to make to what is currently a very stable code-base. I would rather place "hook" methods in the current code so that someone else (maybe us, maybe some contributor that really needs this performant solution) can override them and do this as part of the _sshd-contrib_ package. > support asynchronization mode for sftp subsystem > ------------------------------------------------ > > Key: SSHD-812 > URL: https://issues.apache.org/jira/browse/SSHD-812 > Project: MINA SSHD > Issue Type: New Feature > Affects Versions: 1.7.0 > Environment: java1.8, linux > Reporter: Zhenliang Su > Assignee: Goldstein Lyor > Priority: Minor > Labels: asynchronous, sftp > Attachments: Main.java, doRead.png > > > I used SSHD as a middleman between client and target sftp server. > I found that, when filezilla client directly connect to the target sftp > server, it transfers fast. When filezilla client connect to the middleman, it > transfers slow. > I analyzed the source code of > org.apache.sshd.server.subsystem.sftp.SftpSubsystem#doRead, and I found it > behaves like block mode, and client's other SSH_FXP_READ request blocked in > the same thread. > > my middleman code: > [^Main.java] > -- This message was sent by Atlassian JIRA (v7.6.3#76005)