Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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