Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add snabb get-state multiprocess support #961

Merged
merged 2 commits into from
Sep 27, 2017
Merged

Add snabb get-state multiprocess support #961

merged 2 commits into from
Sep 27, 2017

Conversation

tsyesika
Copy link

This updates snabb get-state to support multi-processes.

Previously we just had all the state counters under /softwire-state/ however in the new configuration (snabb-softwire-v2), we have added state counters under each instance but left the global state counters intact as it were in snabb-softwire-v1. The global counters now act as a summed aggregate of all the instances.

This is achieved by adding a process_states function as part of the support which takes the states and provides one unified state structure. The generic case simply takes the first state data in the table (as before) but specific support functions can be written. The lwaftr's combines all the state data so we have a list of all the instances and then sums all the counters for /softwire-state/.

One important change which has occurred was previously tables (yang lists) were not supported in state.lua. I had to add support to go into the lists, this is done by providing the data (if available) when reading the state. This change had to be made in order to properly enumerate lists with their keys so you can see which key the state data belongs to.

@tsyesika tsyesika requested a review from wingo September 22, 2017 17:48
Copy link

@wingo wingo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm and thank you for graciously agreeing to my feedback on the earlier version of this patch!

cvalue = int(path[-1].split()[1])

if path[0].startswith("instance"):
instance[cname] = instance.get(cname, 0) + cvalue
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this guaranteed to be true? I.e. the leader reads the data from the followers and then makes a sum? Just checking to make sure we don't have race conditions here (follower A reports value ⇒ leader makes sum ⇒ follower A updates value ⇒ sum doesn't match).

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep it should always be true. The reading of the state happens for all the instances (see compute_state_readerand the calls in leader to the respective readers) and then after all the states are read it then sums them (see process_states).

@tsyesika tsyesika merged commit e2e25f9 into lwaftr Sep 27, 2017
@wingo wingo deleted the lwaftr-get-state branch April 18, 2018 12:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants