Subject: Re: SFTP read buffer size

Re: SFTP read buffer size

From: Daniel Stenberg <daniel_at_haxx.se>
Date: Thu, 27 Aug 2020 00:38:03 +0200 (CEST)

On Wed, 26 Aug 2020, Tamar Sery (BLOOMBERG/ 120 PARK) wrote:

> I'm trying to increase the download speed of files using libssh2_sftp_read .
> I was able to see considerable speed increase by using a larger buffer, up
> to 30000. However, any size over 30000 seem to have no affect on actual
> received packet size, all packets are exactly 30000 (except for the last
> chunk of the file, and an occasional 60000 sized packet). Is there a way to
> increase the download speed, using a larger buffer or otherwise?

You don't increase speed by getting larger packet sizes here, as SFTP has a
restriction on the packet size. But if you provide a large buffer to the read
function, libssh2 can do the read in multiple packets so you'll be able to get
more packets back in less time.

In my testing, years ago, I could easily get increased transfer speeds by
increasing the buffer up to well over 100K. This is of course extra noticable
when working with high-RTT high-bandwidth servers.

-- 
  / daniel.haxx.se
_______________________________________________
libssh2-devel https://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel
Received on 2020-08-27