Request regarding CHAN_INPUT_MAX
Chris Rapier
rapier at psc.edu
Sat Apr 11 08:17:24 AEST 2026
On 4/10/26 15:32, Chris Rapier wrote:
>
>
> On 4/9/26 19:05, Damien Miller wrote:
>> On Thu, 9 Apr 2026, Chris Rapier wrote:
>>
>>> Hi all,
>>>
>>> Is there any way that the limit of CHAN_INPUT_MAX could be increased?
>>>
>>> In channels.h it's set to 16MB.
>>> #define CHAN_INPUT_MAX (16*1024*1024)
>>>
>>> Which is fine for most implementations of SSH but it's causing
>>> performance
>>> degradation when OpenSSH is sending data to an HPN-SSH instance. I'm
>>> currently
>>> dealing with this by limiting the advertised window to less than 16MB
>>> but that
>>> limits throughput in this situations. While I'd love it if this was
>>> increased
>>> to 128MB an increase to 32MB or more would help out a lot of my users
>>> (people
>>> often install HPN-SSH on the server side as it provides a throughput
>>> boost to
>>> any client sending data). If HPN-SSH advertises more than that to these
>>> clients the connection might fail or enter a pathological state in
>>> terms of
>>> performance.
>>
>> That's the pathological state here? INPUT_MAX sets the maximum size of
>> the
>> buffer for data that has been locally read by not yet put on the wire.
>> > If the server has advertised a larger channel window then I'd assume
>> that
>> this buffer should pretty much always be empty as it will be drained to
>> the wire by channel_output_poll_input_open() in maxpacket increments.
>
> I can spend some more time nailing this down if you are potentially open
> to this change.
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
For example running an advertised window restricted window to SSH with
CHAN_INPUT_MAX at 512KB at 50ms delay (hpnssh localhost -p3232
-caes256-gcm at openssh.com "cat /dev/zero" > /dev/null) hets me about 5Gbps.
If I run the same against SSH with a 16MB CHAN_INPUT_MAX I get 2.3Gbps.
It's really interesting whats happening. Not expecting you to change
anything on your end I'm just really curious now.
Chris
More information about the openssh-unix-dev
mailing list