sftp performance problem, cured by TCP_NODELAY

Nicolas Williams Nicolas.Williams at sun.com
Fri Jan 27 05:51:53 EST 2006

On Thu Jan 26, 2006, Damien Miller wrote:
> Miklos Szeredi wrote:

First off, how can Nagle be affecting SFTP when SFTP would be doing
"write(lots), write(lots), ..., read()"?

I thought Nagle should only come into effect whem the app does (in
Rick's handwaving terms) "write(little), write(little), ..., read()."

Unless the pipe between ssh/sshd and sftp/sftp-server is breaking up the
read/write size Nagle should not affect sftp.

> > So TCP_NODELAY is already set for interactive sessions.  I hadn't
> > noticed that.
> > 
> > It's actually pretty stupid I think, as Nagle (TCP_NODELAY off) _only_
> > makes sense for _interactive_ sessions.
> It makes zero sense for interactive sessions - do you really want your
> keystrokes delayed?

Whether it does or not, it clearly doesn't make sense to have Nagle on
at the TCP layer when SSHv2 has its own channel multiplexing facility.

Instead SSHv2 clients and servers ought to implement Nagle at the
channel level wherever it is desirable (assuming it is desirable at all)
and keep it off at the TCP layer altogether.

Unfortunately without feedback from TCP about congestion there's no way
to make Nagle adaptive at the SSHv2 connection layer.  Oh well.  Or
could ssh/sshd turn Nagle on/off around the writing of SSHv2 packets for
interactive channels (channels with ptys)?


More information about the openssh-unix-dev mailing list