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

Websocket Publish Subscribe #335

Open
FRosner opened this issue Nov 22, 2017 · 0 comments
Open

Websocket Publish Subscribe #335

FRosner opened this issue Nov 22, 2017 · 0 comments
Milestone

Comments

@FRosner
Copy link
Owner

FRosner commented Nov 22, 2017

Problem

Updates in Broccoli (coming from Nomad and Consul, the template or instance) are propagated to all clients with a fixed delay, independent of whether there are actual changes. This leads to a lot of communication overhead.

Solution

Architecture

img_20171122_113546

Instance Service

On every update write change to the instances (e.g. changing parameters, etc.), we notify the websocket service that there is an update of the instances. The websocket service still has a scheduled thread but it will only send new instances in a new batch if it got notified. Notifications can be booleans and the websocket service can just take the current state when updating all clients.

On every update we receive from Nomad or Consul before overwriting the job and service map inside the InstanceService we calculate a collision free hash of the two data structures, seeing if there is a difference. If there is no difference, we don't update them. On each update we notify all subscribers about the update.

Template Service

On every SIGUSR2 being send to the template storage we can notify the websocket service. If it received a notification it will send the new templates on the next sync timeslot.

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

No branches or pull requests

1 participant