[ssh_x509] read network data directly to the packet input buffer ... really?
ssh_x509 at roumenpetrov.info
ssh_x509 at roumenpetrov.info
Sun Jan 22 20:11:01 EET 2023
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."
Feature was not added to PKIX-SSH as code quality was not enough - buffer function in case of read error code clobbers buffer data or session state.
Updates drops use of predefined buffer size for CYGWIN added with comment "Windows is sensitive to read buffer size". In addition buffer size is increased in client and server to 256K without explanation.
Also performance improvement from 2-3% according commit message is not enough to change code.
These days I decide to run some tests. Updated code with results for test are now part of PKIX-SSH code.
The tests on server loop shows that in all cases performance of existing code is always better then direct write to the packet input buffer.
Moreover the best results are with small memory buffer 4k (15.35% improvements), then 8k, and then original 16k.
Tests on client side show that method and buffer size are irrelevant.
Finally was chosen direct write with same buffer size (8k) as it provides best but insignificant performance of 0.86%.
In addition code allows at build time to define buffer size:
- SSHD_IOBUFSZ (4k): new define for server, 15.35% improvement;
- SSH_IOBUFSZ (8k): existing for client but with possibility to override on CYGWIN as well.
Remark: the default for CYGWIN in both cases is old one, i.e. 64k-1.
Regards,
Roumen Petrov
More information about the ssh_x509
mailing list