Supervisor child pid

Fred Youhanaie fly@REDACTED
Thu Mar 5 10:49:40 CET 2020


On 05/03/2020 08:11, Roger Lipscombe wrote:
> On Thu, 5 Mar 2020 at 06:06, Zsolt Laky <zsoci@REDACTED> wrote:
>> performance can be pretty good as the supervisor process does not wait the "child" process to spin up with a possible long init function, blocking other childs to start.
> 
> If this is your problem, then it's possible to make the child process
> start asynchronously. I wrote something on my blog, here:
> https://blog.differentpla.net/blog/2018/06/12/gen-server-enter-loop/
> 

I'll just add that since OTP/21.0 (or perhaps later) we have a new callback available in gen_server - handle_continue. This will allow init to return immediately, and then continue the rest of the 
initialization asynchronously within the callback, and before the first client message.


Cheers,
Fred


More information about the erlang-questions mailing list