Skip to content

Websocket Publish Subscribe #335

@FRosner

Description

@FRosner

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions