Cut sync time: no auth-rejection sleep on the server, one SSH connection per sync #110

Merged
a73x merged 2 commits from fast-ssh-auth into main 2026-09-05 17:15:28 +00:00
a73x commented 2026-09-05 17:10:25 +00:00 (Migrated from git.a73x.sh)

Users report that every issue or patch write takes about 15 seconds, all of it in the auto-sync.

Root cause, verified against the unmodified release server on loopback: russh sleeps one second before answering every rejected auth attempt (its default auth_rejection_time), and the server left it at the default. OpenSSH is rejected at least once per connection on its "none" probe, plus once per identity it offers ahead of the enrolled one. A sync opens two connections. Measured: 1.08 s per login with the enrolled key alone, +1 s per stray key ahead of it.

Two commits:

  1. Server: both rejection waits drop to zero. The delay is a password-guessing countermeasure; this server accepts only public keys, so it protected nothing. Test times a login with one stray key ahead of the enrolled one: 2.06 s before, 0.12 s after.

  2. Client: the fetch and push share one SSH connection via ControlMaster, appended to whatever ssh command git already uses. Skipped when git would not run OpenSSH or when the socket path would exceed the Unix limit. Test counts logins in the server log per sync: two before, one after.

Against the production remote, sync goes from 4.9 s to 2.7 s with the client change alone; the server change lands once the server is redeployed.

Not in this patch: the delegate certificate my client offers is rejected by the production server, which is one wasted rejection per connection. Worth a separate look.


Migrated from git-collab patche 922d072ed8c8686f52d0a8d0f0c9e94d3b08df12.

Original author: a73x dev@a73x.sh.

Revision 1: bdfbc5fe10a84083772fbb17843cae5ad3eb16b4; base ad04876e01ff0574b9613b7a4b5f96cbd28d81b4

Users report that every issue or patch write takes about 15 seconds, all of it in the auto-sync. Root cause, verified against the unmodified release server on loopback: russh sleeps one second before answering every rejected auth attempt (its default `auth_rejection_time`), and the server left it at the default. OpenSSH is rejected at least once per connection on its "none" probe, plus once per identity it offers ahead of the enrolled one. A sync opens two connections. Measured: 1.08 s per login with the enrolled key alone, +1 s per stray key ahead of it. Two commits: 1. Server: both rejection waits drop to zero. The delay is a password-guessing countermeasure; this server accepts only public keys, so it protected nothing. Test times a login with one stray key ahead of the enrolled one: 2.06 s before, 0.12 s after. 2. Client: the fetch and push share one SSH connection via ControlMaster, appended to whatever ssh command git already uses. Skipped when git would not run OpenSSH or when the socket path would exceed the Unix limit. Test counts logins in the server log per sync: two before, one after. Against the production remote, sync goes from 4.9 s to 2.7 s with the client change alone; the server change lands once the server is redeployed. Not in this patch: the delegate certificate my client offers is rejected by the production server, which is one wasted rejection per connection. Worth a separate look. --- Migrated from git-collab patche `922d072ed8c8686f52d0a8d0f0c9e94d3b08df12`. Original author: a73x <dev@a73x.sh>. Revision 1: `bdfbc5fe10a84083772fbb17843cae5ad3eb16b4`; base `ad04876e01ff0574b9613b7a4b5f96cbd28d81b4`
a73x (Migrated from git.a73x.sh) approved these changes 2026-09-05 17:15:28 +00:00
a73x (Migrated from git.a73x.sh) left a comment

Reviewed both commits. Root cause reproduced on loopback against the unmodified server: one second per rejected auth attempt, including the always-rejected none probe, on each of two connections per sync. Server fix zeroes the delay, justified because only public keys are accepted. Client fix shares one ControlMaster connection across fetch and push with sensible stand-downs for non-OpenSSH commands and long socket paths. Tests fail before and pass after; full suite green apart from the nine pre-existing trust unit tests. Production sync measured 4.9 s to 2.7 s from the client half alone.

Reviewed both commits. Root cause reproduced on loopback against the unmodified server: one second per rejected auth attempt, including the always-rejected none probe, on each of two connections per sync. Server fix zeroes the delay, justified because only public keys are accepted. Client fix shares one ControlMaster connection across fetch and push with sensible stand-downs for non-OpenSSH commands and long socket paths. Tests fail before and pass after; full suite green apart from the nine pre-existing trust unit tests. Production sync measured 4.9 s to 2.7 s from the client half alone.
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
a73x/git-collab!110
No description provided.