cURL / Mailing Lists / curl-library / Single Mail


Re: sftp and buffersize

From: Jonas Schnelli <>
Date: Mon, 17 Oct 2011 16:46:54 +0200

> On Mon, 17 Oct 2011, Jonas Schnelli wrote:
>> I try to improve the poor SFTP speed of libssh2 and the whole SFTP design.
> Are you using libssh2 1.3.0 or directly off git? Do you have poor speeds when using libssh2 directly or only when using it with libcurl?

1.3.0 stable.

>> How can i change the buffersize loaded via the CURLOPT_READFUNCTION callback? The CURLOPT_BUFFERSIZE option only has affect on writing callbacks.
> The primary problem for SFTP with libcurl here is that libcurl doesn't let you grow the buffer size before its internally set size. A 16K buffer is MUCH too small for really efficient SFTP transfer speeds when the RTT to the server is larger than just a few milliseconds.

But is there a chance to change the default 16K buffer to different value? Didn't found it straight away in the libcurl source.
I just wan't to play with the buffer size to see how's the improvement and then decide to keep or through out sftp support in my software (for now :) ).
Or can i somehow hack/change the buffersize in libcurls sftp.c?

>> Any other ideas how to improve the SFTP speed?
> Apart from enlarging the buffer size (a lot), making the buffer use "slide" as in the sftp_write_sliding.c libssh2 example will take the performance further..
> There are other things that could possibly be done, but they would need to be done to libssh2.
> --
> /
> -------------------------------------------------------------------
> List admin:
> Etiquette:

include7 AG
Jonas Schnelli
Grngasse 10
CH-8004 Zrich
Office: +41 44 500 16 70

Skype: jonas.schnelli

Bitte senden sie uns keine sensitiven Daten in unverschlsselten E-Mails.
Verwenden Sie hierzu folgenden Link:


List admin:
Received on 2011-10-17