+1 vote
by (160 points)

Hello !

I have a little problem about upload speed with Rebex sftp.

Here's my problem :
When uploading a file, the maximum speed I can get is ~4 MB/s
With the exact same configuration with winscp, I'm uploading at ~13 MB/s.

Here's my code :

        dtStart = DateTime.Now;
        Sftp client = new Sftp();

        //client.FingerprintCheck += new SshFingerprintEventHandler(client_FingerprintCheck);

        SshPrivateKey pk = new SshPrivateKey(sshRsaPath, pwd);
        string[] tabproxy = proxy.Split(':');
        client.Proxy = new Proxy(ProxyType.HttpConnect, tabproxy[0], int.Parse(tabproxy[1]));
        client.Options |= SftpOptions.UseLargeBuffers;
        client.Connect(host);
        client.Login(login, pwd, pk);
        FileInfo fi = new FileInfo(filePath);
        //client.TransferProgressChanged += new EventHandler<SftpTransferProgressChangedEventArgs>(client_TransferProgressChanged);
        client.PutFile(filePath, dirPath + fi.Name);


        client.Disconnect();

I tried to enable or disable large buffers and using PutFile or Upload method but I don't know what else I could de.

I was trying Rebex in the hope it'll be faster than WinScp (my connection allows me to upload at a maximum of 30 MB/s)

Thanks !

Applies to: Rebex SFTP

1 Answer

0 votes
by (144k points)
selected by
 
Best answer

SFTP and SSH protocols are a bit tricky when it comes to packet sizes and when the client’s and server’s are out of sync, speed suffers.

We have published some additional settings in the following beta build: http://www.rebex.net/getfile/ab52f8a0612f4ef8a23e488c65c1e421/RebexSftp-BetaBuild5641-Trial-Binaries.zip

This makes it possible to specify upload buffer size and upload queue length. When used together with UseLargeBuffers and Compression, another speed increase is possible:

client.Settings.UseLargeBuffers = true;
client.Settings.SshParameters.Compression = true;
client.Settings.UploadBufferSize = 60 * 1024;
client.Settings.UploadQueueLength = 8;

The default value of UploadBufferSize is 28 * 1024, which seems to be a the most compatible and is usually fast enough. However, some servers might prefer higher values.

UploadQueueLength of 8 has been reported to provide another speed increas (over the default UploadQueueLength of 4).

Please give this a try and let me know whether you get any speed increase.

by (160 points)
edited by
Hi Lukas, thank you for you quick answer.

I tried your solution and it is better ! From 4MB/s to almost 8MB/s.

Right now I think my CPU is the next obstacle.

EDIT :
CPU it is ! With a fully multithreaded test application, I was able to reach up to 22MB/s.
But of course for a single file I don't think I can multithread.
...