Siemens-Healthineers / K2s

Kubernetes distribution for Windows & Linux workloads
https://siemens-healthineers.github.io/K2s/
MIT License
37 stars 4 forks source link

Performance for system ssh and scp commands needs to be improved #639

Open abhitoshj opened 3 months ago

abhitoshj commented 3 months ago

Is your feature request related to a problem? Please describe. Whenever k2s system ssh and k2s system scp commands are executed, they take sometime more than 20-30 seconds to begin execution. When many such commands have to executed in sequence, significate delays are observed.

Describe the solution you'd like Improve performance of k2s system ssh and scp commands.

Describe alternatives you've considered When many ssh commands have to be executed in sequence, I generally abstract all such commands in a bash script or a powershell script. This powershell script or bash script is copied onto the node using k2s system scp command and then executed with k2s system ssh commands, So the overall execution time is less than a minute.

Additional context N.A.

siprbaum commented 3 months ago

Just wanting to at least present another option: start a connection to the node at the beginning and end it when everything is done. This would mean only the initial connection is slow, but the next connections will multiplex on the previous connection.

https://www.cyberciti.biz/faq/linux-unix-reuse-openssh-connection/

achimkist commented 1 month ago

ssh and scp are wrapped in a powershell script. The reason why it takes so long is the loading of the modules. Currently the "main" modules (infra. node, cluster modules) are loaded. When loading only the really needed ones the performance can be improved by 50%:

for ssh cmd: current implementation: TotalMilliseconds : 6765.2381 loading only needed modules: TotalMilliseconds : 3598.6043

for scp cmd: current implementation: TotalMilliseconds : 8059.982 loading only needed modules: TotalMilliseconds : 3614.6283

jgriegershs commented 3 weeks ago

Just wanting to at least present another option: start a connection to the node at the beginning and end it when everything is done. This would mean only the initial connection is slow, but the next connections will multiplex on the previous connection.

https://www.cyberciti.biz/faq/linux-unix-reuse-openssh-connection/

This can already be achieved with k2s system ssh [m|w] without adding a command. As result, the prompt to the node stays open until closed by the user or calling system. During that prompt multiple commands can be executed writing to the stdin stream.

jgriegershs commented 3 weeks ago

Ongoing discussion: #788 .

Related discussions: #787 and #789 .