How to improve SSH/SCP performance #788
Replies: 3 comments 3 replies
-
I wanted to test the toolchain once for ssh using "dotting" and not load-module... I believe inlining the powershell stuff would be faster than the load-module aproach... but I like this idea even more. From our side we discussed using ssh directly and not via the k2s wrapper due to the performance limitation. As of now we chain quite alot configuration ssh commands into one cmd just to bypass this ssh-session delay |
Beta Was this translation helpful? Give feedback.
-
For best performance I like the idea to make the ssh/scp connections directly in go, maybe even through a library. |
Beta Was this translation helpful? Give feedback.
-
Please see my comment #789 (comment) regarding an interactive session. Please see my comment #789 (comment) regarding SCP. |
Beta Was this translation helpful? Give feedback.
-
Problem
Users of
k2s system [ssh|scp]
commands as well as maintainers of K2s repeatedly reported very poor performance of those commands.One issue with too many PowerShell modules being loaded is already fixed with #639.
Another way to improve performance is to directly call the underlying executables in Go, i.e.
ssh.exe
andscp.exe
instead of calling PowerShell scripts first.Example
In case of opening an interactive SSH session, the invocation stack currently spans five layers (!):
k2s Go exe -->
sshm
shortcut --> PowerShell wrapper script --> PowerShell script -->ssh.exe
Solution Proposal
Call underlying
ssh.exe
andscp.exe
directly in Go. This would also remove the need to create a costly PowerShell session (which takes at least two seconds on a potent dev machine).PowerShell scripts like sshm.ps1 are merely a wrapper around
ssh.exe
. Also, system status check in PowerShell scripts can be replaced with a stricter timeout when connection via SSH, e.g. of two seconds. That way it would not matter if the K2s system is down in general, when the target machine is still reachable via SSH.Beta Was this translation helpful? Give feedback.
All reactions