curl-library
Re: cURL SFTP upload speed only 50% compared to command line SFTP
Date: Wed, 22 May 2013 19:49:09 +0200 (CEST)
On Wed, 22 May 2013, Ben Thomas wrote:
> Does anyone know of any ways I can speed up cURL, preferably without having
> to upgrade to a new version as I really struggled to get my version
> upgrading when I tried a while ago! But obviously I will if I have to to get
> it working.
This is because SFTP is a tricky protocol in combination with how libssh2's
API for SFTP works. In order to get the best possible speed out of SFTP
transfers with libssh2 an application needs to:
A) use really larger buffers, like several hundred KBs at least
and
B) use a sliding buffer technique instead of letting the existing buffer drain
completely before it gets refilled
(I'll explain why _this_ is necessary some other time. I blogged about some
SFTP and libssh2 details back in the day here:
http://daniel.haxx.se/blog/2010/12/08/making-sftp-transfers-fast/)
If you use libssh2 directly and do the above two adjustments, you can achieve
SFTP transfer speeds close to OpenSSH's sftp tool.
None of these things are made within libcurl, that instead use a mere 16KB
buffer and a draining-buffer technique so it has no chance of reaching high
speeds with the current libssh2.
-- / daniel.haxx.se ------------------------------------------------------------------- List admin: http://cool.haxx.se/list/listinfo/curl-library Etiquette: http://curl.haxx.se/mail/etiquette.htmlReceived on 2013-05-22