10-12-2022 03:41 AM - edited 10-12-2022 03:44 AM
Hi.
If anyone has a ready answer.
How many reads like that
if service.interface == 'GE':
...
elif service.interface == '40GE':
...
..
done in the service code would it take to become noticeable (primarily from the standpoint of taking noticeably longer to execute top to bottom) so that doing this
interface = service.interface
if interface == 'GE':
...
...
would make more sense?
I imagine it depends on the server specs, among other things, but I'm wondering, how heavy is a simple read from the CDB?
Thanks
Solved! Go to Solution.
10-18-2022 12:25 AM
I don't have any actual numbers here but I would greatly advice just reading the value once as in the second example and cache the read value.
maagic did cache values read in previous versions but no longer do so.
Each read involves sending and reading data from a socket communicating and gives a short delay + unnecessary load on NSO. For a few reads this will not be noticeable but as the amount of interface types Increase and load on NSO increase it would be advisable not to read it multiple times.
10-18-2022 12:25 AM
I don't have any actual numbers here but I would greatly advice just reading the value once as in the second example and cache the read value.
maagic did cache values read in previous versions but no longer do so.
Each read involves sending and reading data from a socket communicating and gives a short delay + unnecessary load on NSO. For a few reads this will not be noticeable but as the amount of interface types Increase and load on NSO increase it would be advisable not to read it multiple times.
Discover and save your favorite ideas. Come back to expert answers, step-by-step guides, recent topics, and more.
New here? Get started with these tips. How to use Community New member guide