[ 
https://issues.apache.org/jira/browse/SSHD-812?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16429849#comment-16429849
 ] 

Goldstein Lyor commented on SSHD-812:
-------------------------------------

{quote}
I don't really see the benefit of having multiple threads reading the input 
stream.
It's more the process methods which should be called in an executor.
{quote}
What if there are multiple threads, but only one of them reads a command from 
the input stream, and while it processes the response, another can read the 
next command and so on... ? We would effectively be calling {{process}} 
asynchronously

{quote}
the subsystem would have to use multiple channels for a single handle
{quote}
What if reading/writing/accessing a file handle is synchronized ?

In other words:
{code:java|title=Skeleton thread run() loop}
synchronized (in) {
    Buffer cmd = readCommand(in);
}

Buffer reply = process(cmd);

synchronized (out) {
    writeReply(out, reply);
}
{code}
 
{code:java|title=read/write access}
Buffer doRead(String handle) {
    Handle h;
    synchronized (handlesMap) {
        h = handlesMap.get(handle);
    }

    Buffer data;
    synchronized (h) {
        data = readFromHandle(h);
    }

    return data;
}
{code}

> 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)

Reply via email to