Skip to content

Multi-broker solution #100

@ddrcode

Description

@ddrcode

Status

Fairly good understanding of the behavior, but the implementation details are TBD.
This is the core missing functionality of Maiko. Crucial part of 0.4.0 release.
Don't implement until all points from to be decided section are answered.

Problem

Currently there is only a single broker, that means - all traffic goes through a single task. For larger amount of actors or for heavy traffic - this is a major limitation. However - current solution is implemented having multiple brokers in mind. Means, conceptually, singe broker is a special case of multi-broker architecture. Current solutions, like overflow policy, don't need to change.

Decisions (so far)

  1. Topics can be organized in topic groups (one topic can belong to only one topic group).
  2. Each topic group has exactly one broker.

The above guarantees event ordering withing a group, but not across the groups. In the most extreme case can be one group per topic.

To be decided.

Number of channels. Current channel arithmetic is: actor -> broker channel (stage 1) and broker -> actor channel (stage 2) - per actor. That gives 2A channels in total. With multi-broker it will be 2AB (2 * actors * brokers). For 10 actors and 4 topic groups that's 80 channels. Manageable, but not small, and it will be growing quickly. The question is whether we want to optimize it. if so, then the situation is complicating, because:

  • we only know to which incoming topics an actor subscribes to,
  • that means every actor can send any type of event (topic).

Three options here

  1. one shared sender per Stage 1, shared across actors. For stage 2, as the point below
  2. we optimize the number of stage 2 channels only - easier as we can do it statically during registration, as we know subscribed topics,
  3. we optimze stage 1 and stage 2 by wiring actors with brokers dynamically - on first event

1 is the easiest, 3 the hardest. 2 can work in pair with any stage 1 solution.

For option 3 - we could reuse our command channel. Send request for new channel, specific broker picks it, creates new reader, and sends command with sender. That means first event send is always bit delayed.

Alternative - producers declare what type of events they produce.

Thoughts?

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions