You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@mina.apache.org by Lyor Goldstein <lg...@apache.org> on 2019/04/04 16:16:43 UTC

Re: SshServer timeout and readBufferSize setting

>> I would like to know if there are anyone that can point me in a
direction of
configuring the:
Session Timeout and the Session readBufferSize when using SSHD.
I followed the 5 minute guide and got a server running. I can login and
everything works.

There are several configuration options involved:

* FactoryManager#IDLE_TIMEOUT controls timeout if no SSH packets are
received (default=10 min.)
   In order to keep the session alive there are several mechanisms in place
- see relevant section in documentation

* FactoryManager#NIO2_READ_TIMEOUT controls low-level socket timeout
(default=10min + 15 sec.)

* FactoryManager#NIO2_MIN_WRITE_TIMEOUT controls low-level write timeout -
although I fail to see how
playing with it would increase throughput since it only indicates how long
the sender is willing to wait for the
sent packet to be successfully transmitted. It won't help to have either
short or long timeout since the peer
influences the actual wait time.

* For NIO2 low-level socket options see Nio2Service#CONFIGURABLE_OPTIONS -
which allows one to
configure the socket read/write buffer - I am not sure you want to meddle
with them, but they're there

>> But I have problems with speed when sending/uploading files to the
server.

Please be more specific about what problems exactly are you having - in any
case, please note that:

* SSH is inherently slower than "normal" copy due to the encryption and
protocol overhead

* There are differences between SFTP and SCP - which one are you using for
send/upload ?
       SCP if faster for whole files, while SFTP is tailored for
fine-grained support (e.g. resume a failed upload/download)

* Have you tried activating the compression option of SSH - for large text
files it is a definite throughput improvement

Re: SshServer timeout and readBufferSize setting

Posted by Kasper Johansen <kj...@hypefactors.com>.
Hi Igoldstein,

Thanks for your reply.


>>>> I would like to know if there are anyone that can point me in a
>>>> direction of configuring the: 
>>>>Session Timeout and the Session readBufferSize when using SSHD. 
>>>>I followed the 5 minute guide and got a server running. I can login and
everything works. 

I'm seeing timeout events when transferring large files. 60mb, and above. I
think the setting I would like is the "WriteTimeout", which is by default
set to 60s. Link:
https://mina.apache.org/mina-project/userguide/ch4-session/ch4.1-session-configuration.html
So is that also set using the FactoryManager? 


>>>> But I have problems with speed when sending/uploading files to the 
server. 

>> Please be more specific about what problems exactly are you having - in
>> any case, please note that: 

>> * SSH is inherently slower than "normal" copy due to the encryption and
>> protocol overhead 
That I know, but this here is by factor 40. I did a test with SCP and get a
speed between 4-8MB/s where as with the SFTP server side on same server I
get 120 - 130KB/s.. So something is off.

>>* There are differences between SFTP and SCP - which one are you using for
send/upload ? 
>>     SCP if faster for whole files, while SFTP is tailored for
>> fine-grained support (e.g. resume a failed upload/download) 

I have done both. But I need to get the SFTP up since that is what is needed
in the application that I'm building. (MINA/SSHD -> SFTP server)

>> * Have you tried activating the compression option of SSH - for large
>> text files it is a definite throughput improvement.
No, I will look into that. Thanks. 

So a little more input from me: We have a 1GB/s fiber line and the server is
setup in google cloud. I get 130kb/s when connecting to the MINA/SFTP
application and if I transfere with SCP to same server with that host the
MINA/SFTP application, I get 4-8mb/s. So it seems that the "readBufferSize"
Link:
https://mina.apache.org/mina-project/userguide/ch4-session/ch4.1-session-configuration.html..
Is set to the default 2048kb... I would like to change that to a higher
number, is that also done in the FactoryManager? 
The files I need to transfer is between 1MB-400MB.
Not sure what else to say. 
Again thanks for your reply, and I hope it make more sense now.

Br. 
Kasper





--
Sent from: http://apache-mina.10907.n7.nabble.com/Apache-MINA-Developer-Forum-f6809.html