Subject: Re: SFTP Compression support

Re: SFTP Compression support

From: TJ Saunders <>
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

> 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.



   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

Received on 2010-09-01