Archive Index
This month's Index
|
Subject: SFTP upload speed
SFTP upload speed
From: Daniel Stenberg <daniel_at_haxx.se>
Date: Sun, 5 Dec 2010 00:12:04 +0100 (CET)
Hi friends,
Thanks to Mark Riordan for allowing me to use an account on his machine, I
I've now done libssh2 SFTP uploads just as fast as openssh over my test
Test connection: 140ms latency, 100mbit upload link, unknown bandwidth
Test system: Linux 2.6.30
Test file: 5MB (5 * 1024 * 1024) bytes.
OpenSSH: takes between 1 to 3 seconds to upload
libssh2: takes 2 seconds to upload (for some reason it seems more consistent
(Due to limited disk space in the target server I've only worked with this
The secret
It struck me almost immediately once I started to analyze why the stock
It is sort of an API limitation. If the API is used just like it traditionally
There are but two subtle changes I had to do to the application code to make
1 - the most important: increase the buffer size A LOT. I upped it from 100K
2 - make the code use the buffer in a "sliding" manner so that as soon as
I've committed my modified example as sftp_write_sliding.c
Conclusion
The current library code works perfectly fine for this kind of pipelining and
We should perhaps still consider somehow adding another API that allows the
What's next for me
1 - read your comments and feedback on this mail
2 - work on implementing the similar scheme for SFTP
3 - consider if another API is what we want/need and work with you guys what
-- / daniel.haxx.se _______________________________________________ libssh2-devel http://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-develReceived on 2010-12-05 |