cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
339
Views
10
Helpful
1
Replies

How expensive is reading from CDB via MAAGIC?

u.avsec
Spotlight
Spotlight

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

1 Accepted Solution

Accepted Solutions

cnasten
Cisco Employee
Cisco Employee

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.

View solution in original post

1 Reply 1

cnasten
Cisco Employee
Cisco Employee

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.