Subject: Re: SFTP Compression support

Re: SFTP Compression support

From: TJ Saunders <tj_at_castaglia.org>
Date: Wed, 1 Sep 2010 11:34:56 -0700 (PDT)

> I've just compiled the "sftp_nonblock.c" example, and tried it with an 80 MB
> text file in a remote Linux server. I've commented the line where the output
> is printed in the stdout to avoid performance penalties. The problem is that
> using the compression flag takes more time that without the using the
> compression flag! I've tried several times, and all the tests returned the
> same results: about 120 seconds with the compression flag, and about 90
> seconds without it.

Can you use profiling, like ltrace or strace or something similar, to get
a better idea of where that extra time is being spent?

> I've tried with buffers of 1K, 16K and 32K.

Are these buffers used for the size of the SSH packet payloads, or for the
decompression?

> The compression is enabled at the OpenSSH server side, if I try the transfer
> with an SFTP client, like the sftp command, then it takes about 10 or 20
> seconds.

Another possibility is the size of the channel window that libssh2 uses.
libssh2 has a channel window size of 64K (LIBSSH2_CHANNEL_WINDOW_DEFAULT,
from libssh2.h); OpenSSH (at least looking at the 5.2p1 sources I have
handy) shows a channel window size of 2048K. A smaller window size
results in more back-and-forth traffic; you might try increasing
LIBSSH2_CHANNEL_WINDOW_DEFAULT to see if that affects your tests.

Cheers,
TJ

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

   Where is the Life we have lost in living?
   Where is the wisdom we have lost in knowledge?
   Where is the knowledge we have lost in information?

     -T.S. Eliot

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
_______________________________________________
libssh2-devel http://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel
Received on 2010-09-01