Files
teleport/lib/client
Andrew Lytvynov 53b1eb4727 Reuse a NodeClient when running a single non-shell command
When running `tsh ssh foo@bar cmd` we end up dialing `bar` twice - once to
(maybe) start port forwarding and a second time to execute `cmd`.
Instead, reuse the first connection to run `cmd` and only fall back to
re-dialing if we're matching multiple nodes by label.

This gives ~20-30% speedup for non-interactive commands (useful for
tools like ansible):

```
> hyperfine 'tsh ssh localhost true' '~/src/teleport/build/tsh ssh localhost true'
Benchmark #1: tsh ssh localhost true
  Time (mean ± σ):      65.5 ms ±   5.0 ms    [User: 12.9 ms, System: 6.1 ms]
  Range (min … max):    57.0 ms …  74.2 ms    41 runs

Benchmark #2: ~/src/teleport/build/tsh ssh localhost true
  Time (mean ± σ):      51.7 ms ±   3.2 ms    [User: 9.0 ms, System: 5.0 ms]
  Range (min … max):    48.5 ms …  68.5 ms    57 runs

Summary
  '~/src/teleport/build/tsh ssh localhost true' ran
    1.27 ± 0.12 times faster than 'tsh ssh localhost true'
```
2020-07-20 20:26:13 +00:00
..
2018-10-15 11:52:02 -07:00
2018-10-12 17:42:37 -07:00
2020-05-27 19:36:38 +00:00
2020-06-11 15:58:08 +00:00