multiplexing or keepalive
When we talk about the HTTP protocol, some users could misunderstand multiplexing and keepalive. While the keepalive means you can handle many requests in one connection, and it’s need FIFO. The multiplexing seems an improvement for keepalive, one connection also holds many requests, but don’t need FIFO.
If you connect the remote server frequently, like git push many times, the multiplexing could help to save your time. Because it doesn’t need to establish a new TCP connection every time.
Configuration
Well, the OpenSSH supports multiplexing, and clients could share the connection with the Unix socket.
Just add the Controlpath under the old configuration.
1 | Host ali |
When you firstly connect the server, a Unix socket file is automatically created in your ~/.ssh directory.
1 | ~ ❤ ls ~/.ssh |
This file could be used by other ssh clients who want to connect the same server.
ControlPersist: Please be noted that if the
initial clientclosed, other clients will be closed after that time(600s).
Since we use sshfs, we could combine it with OpenSSH multiplexing. By simply mounting a path, we don’t need to open a new console to stay connected.