ktbyers / netmiko

Multi-vendor library to simplify Paramiko SSH connections to network devices
MIT License
3.62k stars 1.31k forks source link

Performance improvement, support setting DEFAULT_WINDOW_SIZE #3298

Open bitboy85 opened 1 year ago

bitboy85 commented 1 year ago

As already mentioned here: https://github.com/paramiko/paramiko/issues/2238#event-9143547163 the output read / execution performance could be massivly improved by changing paramikos DEFAULT_WINDOW_SIZE in file common.py

This is also true for netmiko.

Just tried it out: Using "show ap summary", textfsm enabled, to a cisco 5520 wlc with around 1000 APs

DEFAULT_WINDOW_SIZE 64* 2**15: Runtime : 0:01:15.651271
DEFAULT_WINDOW_SIZE 4* 2**15: Runtime : 0:00:00.616427

~ 2 minutes vs 1 second

I have no devices from other vendors to test, so those might need another value. My suggestion is to have a good known working value within the device_ype specified with option to the user to override it.

From my tests, a window size of 4* 2**15 works best for Cisco devices.

ktbyers commented 1 year ago

Which version of Netmiko did you test with?

bitboy85 commented 1 year ago

I'm using the current version. 4.2.0

ktbyers commented 1 year ago

Okay, this looks interesting. Let me look into it some more.

network-shark commented 1 year ago

I can't believe this , it's to good to be true .

bitboy85 commented 1 year ago

Did you try it?

network-shark commented 1 year ago

Not yet, I mainly use napalm for my daily work , but it should also benefit from your findings. I do have a pretty large script which runs a lot of commands against a cisco devices and some of the returns like show ip route are pretty big which I hope will be faster afterwards. Will update this if I get some numbers