-
Notifications
You must be signed in to change notification settings - Fork 2
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
feat(consumer): use distributed process supervisors #15
base: main
Are you sure you want to change the base?
Conversation
put registry names scoped to parent module instead of under the global `Registry` name this way 1. registry ids are scoped to their parent module 2. it is consistent with the rest of the code, like `MessageTracker.Supervisor` Signed-off-by: Francesco Noacco <[email protected]>
Replace Kernel's Registry and DynamicSupervisor modules with Horde's distributed versions. We still need to set up clustering with libcluster next. A fork of horde is used instead of the version from hex because of a bug where `extra_arguments` is not passed as a parameter to the processes in a DynamicSupervisor Signed-off-by: Francesco Noacco <[email protected]>
set up clustering using libcluster the topologies will be defined in a second iteration Signed-off-by: Francesco Noacco <[email protected]>
looks good, about your fix consider to open a pr to original Horde repo, so we can keep it up to date |
it's already been done, although I failed to mention it: derekkraan/horde#274 |
{Registry, [keys: :unique, name: AMQPDataConsumer.Registry, members: :auto]}, | ||
{DataUpdater.Supervisor, message_handler: message_handler}, | ||
{DynamicSupervisor, strategy: :one_for_one, name: MessageTracker.Supervisor, members: :auto}, | ||
{AMQPDataConsumer.Supervisor, queues_config: queues_config} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The AMQPDataConsumer.Supervisor
is a plain Elixir Supervisor
and so it contains no way of managing horde membership. It should be distributed, though, even if its children are statically determined.
A quick and dirty way of doing that would be using Horde.DynamicSupervisor
for the AMQPDataConsumer supervisor too
Some TODOs. Based on secomind#15. Signed-off-by: Arnaldo Cesco <[email protected]>
Some TODOs. Based on secomind#15. Signed-off-by: Arnaldo Cesco <[email protected]>
Distributed supervisors
Set up distributed registries and supervisors using horde.
Horde was chosen compared to Swarm for its clear distinction between Supervisor and Registry, which is reflected in the code (for the most part it was just a matter of aliasing to Horde's
{DynamicSupervisor,Registry}
). It is also more actively maintained.For the clustering, we're still using libcluster just like we would for swarm
Still at this time, no topology was specified in the configuration
Clustering manual test
A manual test was performed to make sure all the components were working correctly.
The
cluster_topologies
function was rewritten like soAnd started the application in two machines
Then by spawning processes, it was assessed by looking at the pids and the logs that they evenly distributed between the two machines