Request regarding CHAN_INPUT_MAX
Chris Rapier
rapier at psc.edu
Thu Apr 23 03:31:44 AEST 2026
On 4/10/26 20:31, Damien Miller wrote:
> On Fri, 10 Apr 2026, Chris Rapier wrote:
>
>> I spent some more time nailing this down. It turns out that there seems to be
>> an inverse relationship between CHAN_INPUT_MAX and throughput when OpenSSH is
>> sending to HPN-SSH.
>>
>> If I don't clamp the advertised window on my side
>> CHAN_INPUT_MAX Throughput
>> 16MB 200Mbps
>> 12MB 400Mbps
>> 8MB 950Mbps
>> 4MB 1.5Gbps
>> 1MB 2.8Gbps
>> 512KB 2.8Gbps
>>
>> So yeah. Please don't increase CHAN_INPUT_MAX! In fact, I'd really like to
>> understand this behaviour. Especially because the smaller window size actually
>> seems to make a big difference
>
> I think this is the pathological behaviour I've discussed with you previously
> where a near-full sshbuf that is experiencing lots of small writes undergoes
> expensive compaction operations for each of them.
>
> Maybe it's time to change how buf->max_size is handled. I had a patch for
> that; does https://github.com/djmdjm/openssh-wip/pull/44 help here?
I finally found the time to get around to testing this. I've been in
packaging hell for the past week or so. Anyway, this absolutely improves
the performance and eliminates the previously observed pathological
behaviour on high BDP links where I'm advertising a large buffer. That
said, the patch proposed by dgl to grow rlen more aggressively is
important. When rlen is restricted to SSHBUF_SIZE_INC the client spends
a lot time in reallocs. During that time throughput might be as low at
10-12Mbps (I had to do the same in HPN-SSH).
The downside is, of course, increased memory utilization. It reaches
steady state at about 39-40MB on my testbed once the RTT increase above
25 or 30ms. However, it doesn't get above that once you reach that RTT
threshold. I wouldn't expect that to be a major issue for 99.9% of the
people using OpenSSH though - they just won't encounter it unless it's
bulk data transfer over a high BDP path while talking to an
implementation that advertises large windows.
If there is anything I can do to help get this in mainline please let me
know. I'll be happy to do any of the leg work that I can.
Chris
More information about the openssh-unix-dev
mailing list