I’m taking a class this semester that has me coding little projects in Elixir. Since this is the first time I’m working with this kind of a programming model, I’d really appreciate some help and guidance about how to structure stuff better, I’d really love to learn more about elixir and erlang.
Here’s a link to the project.
Please note that I’m not asking for help in completing this, the project deadline is past and it has been submitted for grading. I want your help to improve it and learn from possible design mistakes.
For reference this is a link to the original prompt
Specifically, my questions would be:
- Is there is a better way to structure my process tree, and how do I supervise this whole tree correctly?
- How do I make this OTP compliant (for the sake of learning about OTP, I’m not even sure if this is the right way to do this)
Any other feedback, comments are most welcome!
Here is an excerpt from the project README about the architecture:
Architecture
- There is a single globally named process that manages all worker nodes and itself called the
MiningServer
which is a GenServer with the name{:global, :mining_server}
- This node is singluar in the network and responsible for distributing work among its children which are the process pool managers from remote nodes
- Each node has a locally named process pool backed by the GenServer
MinerPool
, which recieves work messages from the master nodeMiningServer
and translates them appropriately for its children to do work with. All commuincation is async with a callback to a master node’s listening process - The leaf in this tree of messages is a
Miner
node which does the real heavy lifting in computing theSHA256
of a range of numbers to find valid coin-strings
Drawn as a tree, the network looks like so (arrows indicate flow of messages)
MiningServer
|
V
------------------------------------------------------
|(Node1) | (Node2) | (Node 3) ... | (Node n)
|->MinerPool |->MinerPool |->MinerPool |->MinerPool
|->Miner |->Miner |->Miner |->Miner
|->Miner |->Miner |->Miner |->Miner
... ... ... ...
|->Miner |->Miner |->Miner |->Miner
---------------------------------------------------
|-> MiningServer
PS: If this forum is not the right one for this kind of a topic, please direct me to one that may help in this regard! Really excited to learn about