ParallelSSH / parallel-ssh

Asynchronous parallel SSH client library.
https://parallel-ssh.org
GNU Lesser General Public License v2.1
1.2k stars 149 forks source link

run_command is slower than paramiko #124

Closed mbarkhau closed 6 years ago

mbarkhau commented 6 years ago

I'm not sure anybody is looking at the google group anymore, so I'll try to move this here to github.

I have some existing code using paramiko and was doing some tests to replace it. Unfortunately the round trip time of individual commands seems to be quite a bit slower using pssh. My test code can be found here: https://gist.github.com/mbarkhau/e4f3dde91bbb137b29973c362e2c128e

These are the results

                      min [ms]    max [ms]    avg [ms]
paramiko                  5.60       10.73        7.46
pssh run_command         24.18       69.31       56.47
pssh execute             54.36       59.10       56.12
     open                40.79       43.24       42.19
     cmd                 13.37       15.86       13.92

It looks like the command execution itself is comparable to paramiko, but I haven't found a way to use the API without doing open_session for every single command.

Is there a different way to use the libraries (maybe ssh2-python directly) which would have comparable/better RTT vs paramiko? Maybe this issue can be resolved with improvements to documentation.

mbarkhau commented 6 years ago

Questions were answered on the group after all: https://groups.google.com/forum/#!topic/parallelssh/EMYfeX81QFA

The modified scripts: https://gist.github.com/pkittenis/69adac47f6c83426aa6aff8dbdd0daf0

pkittenis commented 6 years ago

For reference - it is not slower but ~3 times faster. The script was not measuring channel open or close for the plumbum client. An average of 7ms for execute alone is quite high, pointing to quite a bit of overhead in plumbum code.

Execute call only is 0-1ms in ssh2-python and parallel-ssh against a single local host.