Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Speedup rsync with ControlMaster & ControlPath? #3331

Closed
ruudk opened this issue Mar 26, 2014 · 4 comments
Closed

Speedup rsync with ControlMaster & ControlPath? #3331

ruudk opened this issue Mar 26, 2014 · 4 comments

Comments

@ruudk
Copy link

ruudk commented Mar 26, 2014

I'm using vagrant 1.5.1 with the gatling-rsync-auto plugin. It works really great. It notices file changes really fast and then launches vagrant rsync. The problem is that vagrant rsync starts slow.

That's because vagrant rsync loads the ssh-config first and then creates the rsync command with a new ssh connection every time.

The ssh-config alone already takes 700 ms on my system:

$ time vagrant ssh-config web1
real    0m0.763s
user    0m0.618s
sys 0m0.106s

Then I found out about ControlMaster and ControlPath. This allows you to setup a connection ones which you can use later.

Normal connection:

$ time vagrant ssh web1 -c 'hostname; exit;'
web1
Connection to 127.0.0.1 closed.

real    0m1.062s
user    0m0.764s
sys 0m0.182s

With ControlPath and ControlMaster:

$ time ssh -o 'ControlMaster auto' -o 'ControlPath ~/.ssh/vagrant' web1 'hostname; exit'
web1

real    0m0.008s
user    0m0.002s
sys 0m0.002s

Is it possible to integrate this in the rsync command? If the SSH connection stays open,rsync should be faster with syncing, right?

@ruudk
Copy link
Author

ruudk commented Mar 27, 2014

Did some testing:

Create a SSH master connection:

vagrant ssh-config web1 | ssh -t -t -F/dev/stdin -o 'ControlMaster auto' -o 'ControlPath ~/.ssh/vagrant' web1

Run kicker:

kicker -l 0.1 -e "/usr/bin/rsync --verbose --archive --delete -z -e \"ssh -o 'ControlMaster auto' -o 'ControlPath ~/.ssh/vagrant'\" --exclude .vagrant/ --exclude .git/ . vagrant@127.0.0.1:/vagrant" .

Sooo...fast...syncing...wow!

@ThePixelDeveloper
Copy link

@ruudk What's kicker?

@ruudk
Copy link
Author

ruudk commented Mar 27, 2014

It's just for testing this out. It's a filesystem watcher: https://github.com/alloy/kicker

@mitchellh
Copy link
Contributor

This would probably speed thigns up a bit but it seems like the major performance problem with rsync-auto is due to listen, not Vagrant. I think that the SSH lookup time isn't too important at this point.

#3249

@ghost ghost locked and limited conversation to collaborators Apr 13, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants