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
Add PartitionSupervisor #11468
Add PartitionSupervisor #11468
Conversation
A supervisor with that starts multiple partitions of the same child.
Certain processes may become bottlenecks in large systems.
If those processes can have their state trivially partitioned,
in a way there is no dependency between them, then they can use
the `PartitionSupervisor` to create multiple isolated and
independent partitions.
Once the `PartitionSupervisor` starts, you can dispatch to its
children using `{:via, PartitionSupervisor, {name, key}}`, where
`name` is the name of the `PartitionSupervisor` and key is used
for routing.
Co-authored-by: Eric Meadows-Jönsson <eric.meadows.jonsson@gmail.com> Co-authored-by: João Ângelo <angelojr10@gmail.com>
|
|
||
| ## Implementation notes | ||
|
|
||
| The `PartitionSupervisor` requires a name as an atom to be given on start, |
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.
This is a bit limiting, though it will probably suffice for most cases. I find it a bit disappointing that I can't start this from e.g. a child of a dynamic supervisor, or any other process which is started in unknown number of copies.
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.
We could make it generic by using a registry and storing the ETS table there. We would need to assemble the Registry dynamically though but that's not a problem. IIRC many OTP services get started on first use. it is doable and we can do it in the future. :)
Co-authored-by: Fernando Tapia Rico <fertapric@gmail.com>
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.
😍
|
💚 💙 💜 💛 ❤️ |
A supervisor with that starts multiple partitions of the same child.
Certain processes may become bottlenecks in large systems.
If those processes can have their state trivially partitioned,
in a way there is no dependency between them, then they can use
the
PartitionSupervisorto create multiple isolated andindependent partitions.
Once the
PartitionSupervisorstarts, you can dispatch to itschildren using
{:via, PartitionSupervisor, {name, key}}, wherenameis the name of thePartitionSupervisorand key is usedfor routing.