cURL / Mailing Lists / curl-library / Single Mail


Re: sftp and buffersize

From: Daniel Stenberg <>
Date: Mon, 17 Oct 2011 16:33:46 +0200 (CEST)

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?

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

> 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

There are other things that could possibly be done, but they would need to be
done to libssh2.

List admin:
Received on 2011-10-17