Timing comparison for show commands
See original GitHub issueDuring this last time I’ve been doing some testing, making different kind of executions, in terms of delay_factor
, max_loops
, mixed together with send_config_set()
and send_command()
.
My conclusion is three fold:
delay_factor
should be tuned to improve interaction with the network;- if using
config
like commands,send_config_set()
is better; if show-like commands,send_command()
is better; - if
send_config_set()
, better off use it withcmd_verify=True
.
I’ve performed some tests and it is true that when dealing with only config-like commands, send_config_set(cmd_verify=True)
is an absolute winner.
But, when dealing with show-like commands, the picture is somehow different, at least for me.
Let me show you some results:
26 routers;
delayFactor=1;
maxLoops=5000;
device=nokia_sros;
commands=60 different show commands;
netmiko=3.4.0
And these are the code I’m using:
inText = [showCmd1, showCmd2, .... , shwCmd60]
if runType == 'config':
output = conn2rtr.send_config_set(config_commands=inText,
enter_config_mode=False,
cmd_verify=cmdVerify,
delay_factor=delayFactor,
max_loops=maxLoops)
elif runType == 'show':
output = ''
for cmd in inText:
output = output + '\n' + cmd + '\n' + conn2rtr.send_command(cmd,
delay_factor=delayFactor,
max_loops=maxLoops)
The results:
| send_config_set() | | send_command() – | – | --|– Data | verify=no | verify=yes | verify=n/a Count - Router | 26 | 26 | 26 showCommands | 60 | 60 | 60 Min - rxLines | 440 | 440 | 444 Average - rxLines | 5,211.77 | 5,212.73 | 5,216.85 Max - rxLines | 14282 | 14283 | 14287 Min - time(s) | 6.74 | 12.37 | 56.71 Average - time(s) | 13.31 | 17.81 | 60.81 Max - time(s) | 23.16 | 28.74 | 71.29
so, as you can see, the better performance in my case is not obtained with send_command()
but with send_config_set()
.
It’s just a test that I wanted to share with you. I’ve repeated the tests several times, and the numbers are consistent.
Is it may be because I’m concatenating the results when using send_command()
while send_config_set()
gives me the result directly in the output
variable? What is it that I’m doing wrong? Because show comands should better off treated with send_command()
, isn’t it?
Regards!
Lucas
Issue Analytics
- State:
- Created 2 years ago
- Comments:5 (5 by maintainers)
Top GitHub Comments
Okay, your numbers seem reasonably (i.e. make sense to me given how Netmiko works).
With the obvious caveat that I expect send_config_set() to generally not work and to not behave correctly for most show command operations (i.e. most people would run into issues using it).
@ktbyers , thanks for the reply. Just to make it clear, I fully understand that show commands should be used with
send_command()
while config commands withsend_config_set()
. This was just a test that called my attention because of the apparent delay when usingshows + send_command()
compared toshows + send_config_set()
.So, bottom line, II’ll do as you suggest: 1) try the
expect_string
in thesend_command()
call; 2) Try the develop branch. I’ll let you know about the results. thanks!