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

Actor Pattern: load-balancer #63

Draft
wants to merge 8 commits into
base: main
Choose a base branch
from
Draft

Actor Pattern: load-balancer #63

wants to merge 8 commits into from

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.

None yet

1 participant