Cut sync time: no auth-rejection sleep on the server, one SSH connection per sync #110
Loading…
Reference in a new issue
No description provided.
Delete branch "fast-ssh-auth"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
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:
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.
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; basead04876e01ff0574b9613b7a4b5f96cbd28d81b4Reviewed 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.