Skip to content

Conversation

@JohnMurray
Copy link
Owner

@JohnMurray JohnMurray commented May 10, 2023

Summary

Adds a new package to busan (patterns), which is meant to contain message-sending and actor-construction "patterns" that are flexible/reusable. The first pattern being contributed is a load-balancer.

This is impelemented as an actor that is created with a list of addresses to act as nodes in the pool and simply acts as a forwarder. That is messages are received and then dispatched to a node, whos selection is based on the routing strategy. The two routing strategies available in this initial implementation are round-robin and random. But there is nothing stopping the an implementation of additional strategies such as least-busy (with some simple accounting to track queue-depth).

In implementing the load-balancer, several bits of supporting changes were needed inorder to make it possible. These changes are:

Motivation

One of the major strengths of actors, as a programming and concurrency model, is their ability to be flexibly composed. Implementing some simple patterns allows me to test the abilities of busan the meet these demands.

Put plainly, building out these patterns goes a lnogway towards maing sure busan is actually useful in building interesting things.

Test Plan

  • Add a new example that uses the new load-balancer
  • Add an integration test and validates each strategy
    • Random
    • RoundRobin

@JohnMurray JohnMurray changed the title Load balancer Actor Pattern: load-balancer May 19, 2023
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