ControlMaster functionality in SSH has been around for a while, but I learned about it only yesterday: it’s impressive.
ControlMaster multiplexes all connections to defined hosts through a single TCP connection, dramatically lowering the time it takes to initiate a new connection. Only worthwhile doing if you set up multiple connections to the same host.
For example, from where I am at the moment, running a short command over SSH takes almost 3.5 seconds of wall-clock time:
I enable ControlMaster by configuring the following in ~/.ssh/config
:
I create the specified directory for the Unix sockets, and start the first session to the target host.
In another terminal, I then re-run the command I used above:
Very impressive. This is an SSH option I will keep enabled.
OpenSSH 5.5 introduces an option called ControlPersist
which automatically starts
a background multiplexer when connecting to a host for the first time. This
background connection can stay alive indefinitely or it can be set to close
after a specified duration of inactivity.