Re: non-interactive ssh is slow

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Re: non-interactive ssh is slow

Spencer Deinum
I get like 3~5 seconds of latency when running a command with ssh -c.

It's not really a huge deal but it'd be nice to see this improved, its even worse if you have to run multiple commands on the box.

On Wednesday, November 28, 2012 3:00:32 PM UTC-5, Mitchell Hashimoto wrote:
Chris,

I haven't done any profiling here but I am going to just agree that it is probably Ruby being ridiculously slow. Going forward, I actually plan on binding Vagrant to a C-based SSH library, so this should speed things up quite a bit.

Best,
Mitchell


On Tue, Nov 27, 2012 at 10:07 PM, Chris Berkhout <<a href="javascript:" target="_blank" gdf-obfuscated-mailto="H7b0KzKEPrQJ">chrisb...@...> wrote:
Hi All,

If I run "time vagrant ssh" and immediately enter "exit", it exits pretty quickly:

real    0m1.284s
user    0m0.943s
sys     0m0.212s

But if I tell vagrant to run it for me it takes a lot longer:

$ time vagrant ssh -c exit

real    0m5.084s
user    0m1.035s
sys     0m0.215s

turning up the logging, it seems the former is actually running a system ssh command and the latter is probably using a Ruby ssh library.

I have a provision task I'd like to be quick, because actually it only needs to run on the machine once, and I don't want it slowing every provision by 5 seconds:

  config.vm.provision :shell, :inline => "cp --parents .ssh/authorized_keys /root"

I guess if it's just ruby being slow, maybe we're stuck with it, but hopefully I've missed something. Maybe I can tell it to ignore the output or force it to use system ssh?

Any thoughts?

Cheers,
Chris


--
You received this message because you are subscribed to the Google Groups "Vagrant" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/groups/opt_out.
 
 
Reply | Threaded
Open this post in threaded view
|

Re: non-interactive ssh is slow

Andrew Coulton

There's actually a 4 second delay when Vagrant first opens the SSH connection to the guest, implemented with this `sleep 4` here (it's also present in the equivalent class in the 1.0 series).

According to the comment it was introduced to resolve a series of issues eg https://github.com/mitchellh/vagrant/issues/391 which seem to relate to problems getting a connection to the guest during or soon after boot.

I've found once the first command runs the channel then runs fast enough so if you are able to combine your commands into a single execution you should see better performance.

Cheers,

Andrew

On Tuesday, April 2, 2013 6:08:46 PM UTC+1, Spencer Deinum wrote:
I get like 3~5 seconds of latency when running a command with ssh -c.

It's not really a huge deal but it'd be nice to see this improved, its even worse if you have to run multiple commands on the box.

On Wednesday, November 28, 2012 3:00:32 PM UTC-5, Mitchell Hashimoto wrote:
Chris,

I haven't done any profiling here but I am going to just agree that it is probably Ruby being ridiculously slow. Going forward, I actually plan on binding Vagrant to a C-based SSH library, so this should speed things up quite a bit.

Best,
Mitchell


On Tue, Nov 27, 2012 at 10:07 PM, Chris Berkhout <[hidden email]> wrote:
Hi All,

If I run "time vagrant ssh" and immediately enter "exit", it exits pretty quickly:

real    0m1.284s
user    0m0.943s
sys     0m0.212s

But if I tell vagrant to run it for me it takes a lot longer:

$ time vagrant ssh -c exit

real    0m5.084s
user    0m1.035s
sys     0m0.215s

turning up the logging, it seems the former is actually running a system ssh command and the latter is probably using a Ruby ssh library.

I have a provision task I'd like to be quick, because actually it only needs to run on the machine once, and I don't want it slowing every provision by 5 seconds:

  config.vm.provision :shell, :inline => "cp --parents .ssh/authorized_keys /root"

I guess if it's just ruby being slow, maybe we're stuck with it, but hopefully I've missed something. Maybe I can tell it to ignore the output or force it to use system ssh?

Any thoughts?

Cheers,
Chris


--
You received this message because you are subscribed to the Google Groups "Vagrant" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/groups/opt_out.
 
 
Reply | Threaded
Open this post in threaded view
|

Re: non-interactive ssh is slow

Mitchell Hashimoto
Andrew,

True. I actually haven't heard of people hitting issue #391 lately... maybe I can remove the sleep and see what happens.

Mitchell


On Wed, Apr 3, 2013 at 8:23 AM, Andrew Coulton <[hidden email]> wrote:

There's actually a 4 second delay when Vagrant first opens the SSH connection to the guest, implemented with this `sleep 4` here (it's also present in the equivalent class in the 1.0 series).

According to the comment it was introduced to resolve a series of issues eg https://github.com/mitchellh/vagrant/issues/391 which seem to relate to problems getting a connection to the guest during or soon after boot.

I've found once the first command runs the channel then runs fast enough so if you are able to combine your commands into a single execution you should see better performance.

Cheers,

Andrew

On Tuesday, April 2, 2013 6:08:46 PM UTC+1, Spencer Deinum wrote:
I get like 3~5 seconds of latency when running a command with ssh -c.

It's not really a huge deal but it'd be nice to see this improved, its even worse if you have to run multiple commands on the box.

On Wednesday, November 28, 2012 3:00:32 PM UTC-5, Mitchell Hashimoto wrote:
Chris,

I haven't done any profiling here but I am going to just agree that it is probably Ruby being ridiculously slow. Going forward, I actually plan on binding Vagrant to a C-based SSH library, so this should speed things up quite a bit.

Best,
Mitchell


On Tue, Nov 27, 2012 at 10:07 PM, Chris Berkhout <[hidden email]> wrote:
Hi All,

If I run "time vagrant ssh" and immediately enter "exit", it exits pretty quickly:

real    0m1.284s
user    0m0.943s
sys     0m0.212s

But if I tell vagrant to run it for me it takes a lot longer:

$ time vagrant ssh -c exit

real    0m5.084s
user    0m1.035s
sys     0m0.215s

turning up the logging, it seems the former is actually running a system ssh command and the latter is probably using a Ruby ssh library.

I have a provision task I'd like to be quick, because actually it only needs to run on the machine once, and I don't want it slowing every provision by 5 seconds:

  config.vm.provision :shell, :inline => "cp --parents .ssh/authorized_keys /root"

I guess if it's just ruby being slow, maybe we're stuck with it, but hopefully I've missed something. Maybe I can tell it to ignore the output or force it to use system ssh?

Any thoughts?

Cheers,
Chris


--
You received this message because you are subscribed to the Google Groups "Vagrant" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/groups/opt_out.
 
 

--
You received this message because you are subscribed to the Google Groups "Vagrant" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/groups/opt_out.