cygwin performance problem

Corinna Vinschen vinschen at
Wed Apr 19 02:11:06 EST 2006

On Apr 18 22:47, Damien Miller wrote:
> On Tue, 4 Apr 2006, Corinna Vinschen wrote:
> > Not sure if it's ok to discuss this here. However, we have some
> > performance problems on Cygwin with the vanilla version of OpenSSH.  The
> > main problem is the size of the read buffers in the client loop, resp.
> > client_process_net_input/client_process_input.  The buffer size is a
> > fixed 8K.  For some reason this degrades performance on Windows
> > enormously
> Is it necessary to adjust both these buffers? Or does increasing only
> the network buffer in client_process_net_input() help?

Yes, it's apparently enough to change the buffer in client_process_net_input.
> > By raising the aforementioned buffers in clientloop.c from 8192 to, say,
> > 87380 (default tcp recv buffer size), the latter copy is way faster:
> Have you tried smaller numbers than 87380? It isn't much effort to
> crank these buffers up if smaller reads have a performance penalty
> on Windows, but I'd prefer to make changes based on some measurements.
> Could you try a range of buffer sizes from 8192 up (doubling perhaps)
> and see if there is a sweet spot of size vs. performance?

I must admit that I have only tried 65536 and bigger sizes.  I made some
tests now with smaller buffer sizes, and the results are interesting.
There's a performance maximum, which is at buffer sizes between 17408
and 21504 bytes.  Every other buffer size below or above these values
results in a decrease in performance.

  Buffersize   Throughput
    Bytes          MB/s

     8192          1.3
    12288          3.5
    16384          6.6
    17408          9.1
    18432          9.1
    19456          9.1
    20480          9.1
    21504          9.1
    22528          5.9
    24576          5.9
    32768          5.9 
    49152          5.9
    65536          5.6
    87380          5.6
   131072          5.6
   524288          5.6

I don't see a reason for the maximum at this 17K to 21K area, but it's
definitely not a problem of intermediate buffering in Cygwin.  The user
buffer is directly used in the call to the underlying Windows sockets

So, well, maybe setting the buffer size to 20480 would be a useful
compromise for all OSes?!?


Corinna Vinschen
Cygwin Project Co-Leader
Red Hat

More information about the openssh-unix-dev mailing list