On Sun, 2 Dec 2012, scout_game_at_hushmail.me wrote:
> I have a question, i built libssh2 with zlib support. Does that mean that
> scp and sftp functions will automatically uses zlib compression by default
> or should I inform libssh2 to use zlib by calling a special function from
> library ?
libssh2_session_flag() with the LIBSSH2_FLAG_COMPRESS bit set. But in general
compression is not such a good idea as it sounds...
> another question because I figured that sftp is slow and haven't seen any
> optimization in delay the transfer of files takes from local computer to
> server.
We've discussed how to optimize SFTP transfers on this list many times but I
don't think we've ever actually documented them. We should make a "best
practises" document for application that want high speed SFTP.
Two quick tips are:
* never force the buffer to have to get completely sent until you send the
next buffer - see the sftp_write_sliding.c for an example of a sliding
upload buffer that doesn't wait for a full "block" to be sent before it
moves on to send more.
* Use very large buffers. SFTP suffers from round-trip delays for each 30K of
data so the trick is really to be able to send as many 30K blocks as
possible "at once". By providing several hundred K at once to libssh2 gives
it the chance to do more work in parallel.
> Is there any think can be done to speed up sftp transfers ? probably
> something like activating keep alive ?
Keep alive doesn't help your performance while transfering data, but of course
keeping connections alive will make the time to get the subsequent transfer to
start to possibly be faster by avoiding a connect/disconnect sequence.
-- / daniel.haxx.se _______________________________________________ libssh2-devel http://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-develReceived on 2012-12-02