This project is read-only.

About the speed

Mar 6, 2014 at 11:53 AM
Edited Mar 6, 2014 at 11:54 AM
I would like to suggest how to speed up file transfers. I tested two connections - one through and one through winscp. The same endpoints and to the same server service. Speed differs about 10 times.
I captured traffic of connections with wireshark and searched for difference. Transfer was clear, withnout retransmissions or other fails. The point of low speed is probably in too small TCP window size in TCP window is number of bytes, which can send the sender side withnout acknowledgement from receiver. When the window is small, the sender send the numer of bytes and has to wait for acknowledgement from the receiver before continue sending. The window size is probably constant in all the time but other applications works with the size.
Can you (developer) try to play with it?
Your product is realy great, thank you very much.

PS: TCP window -
PS1: sorry for bad english :-)
Mar 7, 2014 at 1:20 PM
Edited Mar 7, 2014 at 1:24 PM

in file SftpFileStream.cs is predefined too small buffer - 4096 bytes is not enought.

    internal SftpFileStream(SftpSession session, string path, FileMode mode)
        : this(session, path, mode, FileAccess.ReadWrite, __4096__, false)
        // Nothing to do here.

    internal SftpFileStream(SftpSession session, string path, FileMode mode, FileAccess access)
        : this(session, path, mode, access,__4096__, false)
        // Nothing to do here.
Change it to bigger, min 65536 or up.

you also have to change buffer size check, to go thru
  internal SftpFileStream(SftpSession session, string path, FileMode mode, FileAccess access, int bufferSize, bool          useAsync)

  if (bufferSize <= 0 || bufferSize > __16__ * 1024)
            throw new ArgumentOutOfRangeException("bufferSize");
It will speed up 3x, but it still about 3x slower than others (I compare to winscp).
It is difficult go deeper.
Mar 23, 2014 at 3:43 PM
Performance of should have improved significantly with the changes I committed yesterday.
There's still room for improvement though.
Mar 24, 2014 at 9:14 AM
Super, I will test it. Thaks a lot.
Apr 6, 2014 at 5:05 PM
A new beta release is now available.
Please try SSH.NET 2014.4.6-beta1 and let me know if performance has improved for you.
Marked as answer by drieseng on 4/6/2014 at 9:06 AM
May 5, 2014 at 10:37 AM
OK, this release is much better, speed is the same like previous with my modifications. Now it is still slower in comparison with others (WinSCP).
Thanks a lot.
May 5, 2014 at 7:05 PM
Thanks for the feedback!
What buffer size are you testing with ?
We now default to a buffer size of 64 KB instead of 16 KB.
You may want to check if you've explicitly configured it to a another (lower) value.