[ssh_x509] read network data directly to the packet input buffer ... really?

ssh_x509 at roumenpetrov.info ssh_x509 at roumenpetrov.info
Fri Jan 27 00:23:08 EET 2023


ssh_x509 at roumenpetrov.info wrote:
> Hello,
>
> One of OpenSSH 8.9 (2022-02-23) new features is to "read network data directly to the packet input buffer instead of indirectly via a small stack buffer. Provides a modest performance improvement."
[SNIP]

Second part.
In addition to main-loops direct read was added to "channel read". After review I note inconsistency in implementation. Existing code "reserve" CHAN_RBUF (16k) buffer while in "channel direct read" it is ignored and is used 256K.

So for tests and to avoid inconsistency in PKIX-SSH is used define CHAN_RBUF in the same place. Results from tests are visible in channels.c.
In brief increase of channel buffer decrease drastically performance. Best result is with 4k buffer ~ 63% improvements to current (16k).

It is visible that adding direct write to the packet input does not add significant improvement. For instance -0.42%(16k), 0.21%(8), -0.66%(4k). Negative means that "with direct" is better positive means that without is better.
Another point is  deviation on 4k buffer: 0.046 (without) vs 0.135 (with).


As result from tests I decided do not activate functionality that writes directly into packet input buffer. It is available but not build by default.

About buffer sizes. Following preprocessor define them:
- SSHD_IOBUFSZ (4k): server main loop
- SSH_IOBUFSZ (8k): client main loop
- CHAN_RBUF (4k): channel read and input buffer.



Those defines allows build to be adapted to specific OS.
For instance CYGWIN buffer size hack is removed. Package maintainer could specify sizes at build time.

Regards,
Roumen Petrov







More information about the ssh_x509 mailing list