ssh connection caching

Ssh connection caching is now enabled automatically by git-annex. Only one
ssh connection is made to each host per git-annex run, which can speed some
things up a lot, as well as avoiding repeated password prompts. Concurrent
git-annex processes also share ssh connections. Cached ssh connections are
shut down when git-annex exits.

Note: The rsync special remote does not yet participate in the ssh
connection caching.
This commit is contained in:
Joey Hess 2012-01-20 15:34:52 -04:00
parent 25f998679c
commit 47250a153a
9 changed files with 173 additions and 23 deletions

View file

@ -57,16 +57,3 @@ b) From the desktop add the remote
So now you can work on the train, pop on the wifi at work upon arrival, and sync up with a `git pull && git annex get`.
An alternative solution may be to use direct tunnels over Openvpn.
## Optimising SSH
Running a `git annex get .`, at least in the version I have, creates a new SSH connection for every file transfer (maybe this should be a feature request?)
Lot's of new small files in an _annex_ cause lot's of connections to be made quickly: this is an relatively expensive overhead and is enough for connection limiting to start in my case. The process can be made much faster by using SSH's connection sharing capabilities. An SSH config like this should do it:
# Global Settings
ControlMaster auto
ControlPersist 30
ControlPath ~/.ssh/master-%r@%h:%p
This will create a master connection for sharing if one isn't present, maintain it for 30 seconds after closing down the connection (just-in-cases') and automatically use the master connection for subsequent connections. Wins all round!

View file

@ -15,7 +15,9 @@ Simple, when performing various git annex command over ssh, in particular a mult
>> pid. Then at shutdown, run `ssh -O exit` on each such socket.
>>
>> Complicated slightly by not doing this if the user has already set up
>> more broad ssh connection caching. --[[Joey]]
>> more broad ssh connection caching.
>>
>> [[done]]! --[[Joey]]
---