www.libssh2.org | Daily snapshots | Mailing list archive | Docs | Examples

Archive Index This month's Index

Subject: Re: SFTP upload speed

Re: SFTP upload speed

From: Daniel Stenberg <daniel_at_haxx.se>
Date: Mon, 6 Dec 2010 00:19:37 +0100 (CET)

On Sun, 5 Dec 2010, Daniel Stenberg wrote:

> I've now done libssh2 SFTP uploads just as fast as openssh over my test
> connection! The perhaps most intersting point of all: I didn't change the
> library code to make this happen!

I re-ran my tests against localhost where I upload 1024000000 bytes to a
openssh server on 127.0.0.1.

I showed that to make the same app reach really good speeds, I need to do a
little code tweak and change MAX_SFTP_OUTGOING_SIZE from 4000 to 30000. The
tests I did yesterday with the high latency tests didn't show any real
difference whatever I had that size set to.

That number is the size in bytes that libssh2 cuts off the large input buffer
and sends off as an individual sftp packet.

Using size 30000 I reach about 28 seconds (36MB/sec) which is still almost 50%
slower than openssh which does the same upload in 19 seconds (51MB/sec)

I think perhaps that size could be made dynamic so that we use a smaller value
if the buffer given to libssh2_sftp_write() is small, and use the large value
only if the given buffer is big enough. There's clearly room for some further
tests to check how that can be done sensibly for best performance...

-- 
  / daniel.haxx.se
_______________________________________________
libssh2-devel http://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel
Received on 2010-12-06

the libssh2 team