Skip to content

⚡Streamlined event streaming and distributed worker pools in Go⚡

License

Notifications You must be signed in to change notification settings

goadesign/pulse

Repository files navigation

Pulse

Pulse consists of a set of packages that enable event driven distributed architectures at scale. Each package is designed to be used independently but they can also be combined to implement more complex architectures.

Replicated Maps

Replicated maps provide a mechanism for sharing data across distributed nodes and receiving events when the data changes.

%%{init: {'themeVariables': { 'edgeLabelBackground': '#7A7A7A'}}}%%
flowchart LR
    A[Node A]
    B[Node B]
    Map[Replicated Map]
    A-->|Set|Map
    Map-.->|Update|B

    classDef userCode fill:#9A6D1F, stroke:#D9B871, stroke-width:2px, color:#FFF2CC;
    classDef pulse fill:#25503C, stroke:#5E8E71, stroke-width:2px, color:#D6E9C6;

    class A,B userCode;
    class Map pulse;

    linkStyle 0 stroke:#DDDDDD,color:#DDDDDD,stroke-width:3px;
    linkStyle 1 stroke:#DDDDDD,color:#DDDDDD,stroke-width:3px;
Loading

See the rmap package README for more details.

Streaming

Pulse streams provide a flexible mechanism for routing events across a fleet of microservices. Streams can be used to implement pub/sub, fan-out and fan-in topologies.

%%{init: {'themeVariables': { 'edgeLabelBackground': '#7A7A7A'}}}%%
flowchart LR
    A[Event Producer]
    subgraph SA[Stream A]
        TA[Topic]
    end
    subgraph SB[Stream B]
        TB[Topic]
    end
    B[Event Consumer]
    A-->|Add|TA
    A-->|Add|TB
    TA-.->|Event|B
    TB-.->|Event|B

    classDef userCode fill:#9A6D1F, stroke:#D9B871, stroke-width:2px, color:#FFF2CC;
    classDef pulse fill:#25503C, stroke:#5E8E71, stroke-width:2px, color:#D6E9C6;

    class A,B userCode;
    class SA,SB,TA,TB pulse;

    linkStyle 0 stroke:#DDDDDD,color:#DDDDDD,stroke-width:3px;
    linkStyle 1 stroke:#DDDDDD,color:#DDDDDD,stroke-width:3px;
    linkStyle 2 stroke:#DDDDDD,color:#DDDDDD,stroke-width:3px;
    linkStyle 3 stroke:#DDDDDD,color:#DDDDDD,stroke-width:3px;
Loading

See the streaming package README for more details.

Dedicated Worker Pool

Pulse builds on top of replicated maps and streaming to implement a dedicated worker pool where jobs are dipatched to workers based on their key and a consistent hashing algorithm.

%%{init: {'themeVariables': { 'edgeLabelBackground': '#7A7A7A'}}}%%
flowchart LR
    A[Job Producer]
    subgraph Pool[Pool Node]
        Sink
    end
    subgraph Worker[Pool Node]
        Reader
        B[Worker]
    end
    A-->|Job+Key|Sink
    Sink-.->|Job|Reader
    Reader-.->|Job|B

    classDef userCode fill:#9A6D1F, stroke:#D9B871, stroke-width:2px, color:#FFF2CC;
    classDef pulse fill:#25503C, stroke:#5E8E71, stroke-width:2px, color:#D6E9C6;

    class A,B userCode;
    class Pool,Sink,Reader,Worker pulse;

    linkStyle 0 stroke:#DDDDDD,color:#DDDDDD,stroke-width:3px;
    linkStyle 1 stroke:#DDDDDD,color:#DDDDDD,stroke-width:3px;
    linkStyle 2 stroke:#DDDDDD,color:#DDDDDD,stroke-width:3px;
Loading

See the pool package README for more details.

Examples

See the examples directory for examples of how to use the packages in this repository.

If you are looking for a more complete example of how to use Pulse to build a distributed system, check out the weather example.

License

Pulse is licensed under the MIT license. See LICENSE for the full license text.

Contributing

See CONTRIBUTING for details on submitting patches and the contribution workflow.

Code of Conduct

This project adheres to the Contributor Covenant code of conduct. By participating, you are expected to uphold this code. Please report unacceptable behavior to [email protected].

Credits

Pulse was originally created by Raphael Simon.