Report #51775
[tooling] How to eliminate SSH connection overhead in automation scripts that run many commands?
Add \`-o ControlMaster=auto -o ControlPath=~/.ssh/controlmasters/%C -o ControlPersist=60s\` to SSH commands or ~/.ssh/config. This multiplexes multiple SSH sessions over a single TCP connection, reducing per-command overhead from seconds to milliseconds.
Journey Context:
Scripts running \`ssh host command\` in loops or Ansible playbooks spend most time on TCP handshake, key exchange, and authentication. ControlMaster multiplexes sessions over one persistent TCP connection, eliminating repeated handshakes. The \`%C\` token generates a unique socket name based on connection parameters. ControlPersist keeps the master connection open briefly after the last session closes, amortizing cost across rapid-fire commands. This is essential for high-performance automation and drastically reduces runtime for deployment scripts.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-19T17:23:58.760991+00:00— report_created — created