Is there a maximum number of child processes a supervisor process can supervise? I'm coming from Elixir, but I imagine the limit (if there is one) would be inherited directly from Erlang.
I'm no expert but found this in the erlang docs:
10.2 System limits
The Erlang language specification puts no limits on number of processes, length of atoms etc., but for performance and memory saving reasons, there will always be limits in a practical implementation of the Erlang language and execution environment.
Processes
The maximum number of simultaneously alive Erlang processes is by default 32768. This limit can be raised up to at most 268435456 processes at startup (see documentation of the system flag +P in the erl(1) documentation). The maximum limit of 268435456 processes will at least on a 32-bit architecture be impossible to reach due to memory shortage.
This doesn't mention gen_server
but it puts an upper bound on the number of concurrent processes in a default erlang system: 32768
. So perhaps the answer to your question is simply 32768 - 1
. :) And you can use the +P switch to increase that number.
gen_server
itself doesn't impose any particular restriction on the number of processes it can manage (apart from system limits) but if you add large enough amounts of children, you will (of course) eventually run into performance issues. gen_server
tries to be efficient regarding large number of children by e.g. not storing them in a linear list.
(If you really need to know the exact answer, you're probably designing your system in a suboptimal way, I would say.)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With