On Fri, 13 Mar 2009, Daniel Stenberg wrote:

> Sure we can compare against any other tool, but I think it makes sense to 
> make the comparisons against a single tool just to make it easier for 
> ourselves. And I would assume openssh to be fine for that, unless it is 
> particularly bad or otherwise being naugty or something but I'm not aware of 
> anything like that.

Ok, I committed an update to example/simple/sftp_nonblock.c just now that 
makes it much more suitable for speed testing SFTP downloads.

My tests from just now show (from 127.0.0.1 where OpenSSH_5.1p1 runs an sftp 
server on a Debian system):

libssh2:

        Got 1024000 bytes in 9633 ms = 106301.3 bytes/sec spin: 17

openssh:

        Got the same file in 1 second at 1MB/sec

Kinda depressing comparison I would say. And this is with a 16K read buffer to 
libssh2_sftp_read(), when I tried a 1K buffer I got the transfer take four 
times longer! The 'spin' number is the number of times libssh2 returned EAGAIN 
during the transfer loop.

So, what's taking all this time?

libssh2:
real    0m10.641s
user    0m0.108s
sys     0m0.108s

vs

openssh: (real slightly longer since it prompted me for key passphrase)
real    0m1.336s
user    0m0.004s
sys     0m0.024s

So I ran the thing with valgrind --tool=callgrind, and I think it is somewhat 
interesting:

libssh2_sftp_read() got called 2001 times. Why? 10MB in 16KB chunks should 
end up in way way less calls.

I'll look into this issue as my next step.

-- 

  / daniel.haxx.se

------------------------------------------------------------------------------
Apps built with the Adobe(R) Flex(R) framework and Flex Builder(TM) are
powering Web 2.0 with engaging, cross-platform capabilities. Quickly and
easily build your RIAs with Flex Builder, the Eclipse(TM)based development
software that enables intelligent coding and step-through debugging.
Download the free 60 day trial. http://p.sf.net/sfu/www-adobe-com
_______________________________________________
libssh2-devel mailing list
libssh2-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/libssh2-devel

Reply via email to